test/Misc/EFTools/InProcTests/UndoRedoTestsRemote.cs
/// <summary>
///     Create a function import returning a complex type then undo.
/// </summary>
Create a function import returning a complex type then undo.
Create a function import returning a complex type then undo .
[TestMethod]
        [HostType("VS IDE")]
        public void FunctionImportReturnComplexType()
        {
            UITestRunner.Execute(TestContext.TestName, 
                () =>
                    {
                        const string testName = "UndoRedo.FunctionImportReturnComplexType";
                        ExecuteUndoRedoTest(
                            testName, "NorthwindModel.edmx", (commandProcessorContext, artifact) =>
                                {
                                    var dte = VsIdeTestHostContext.Dte;
                                    var commandProcessor = new CommandProcessor(commandProcessorContext);
                                    var createComplexTypeCmd = new CreateComplexTypeCommand("Sales_by_year_result", true);
                                    commandProcessor.EnqueueCommand(createComplexTypeCmd);
                                    commandProcessor.EnqueueCommand(
                                        new CreateComplexTypePropertyCommand("Column1", createComplexTypeCmd, "Int32", false));
                                    commandProcessor.EnqueueCommand(
                                        new CreateFunctionImportCommand(
                                            artifact.GetFreshConceptualEntityContainer("NorthwindEntities"),
                                            artifact.GetFreshStorageFunction("Sales_by_Year"),
                                            "myfunctionimport",
                                            createComplexTypeCmd));
                                    commandProcessor.Invoke();
                                    Assert.IsNotNull(artifact.GetFreshComplexType("Sales_by_year_result"));
                                    Assert.IsNotNull(artifact.GetFreshComplexType("Sales_by_year_result"));
                                    Assert.IsNotNull(artifact.GetFreshFunctionImport("myfunctionimport"));
                                    Assert.AreEqual(
                                        "Collection(NorthwindModel.Sales_by_year_result)",
                                        ((SingleItemBinding<ComplexType>)artifact.GetFreshFunctionImport("myfunctionimport").ReturnType)
                                            .RefName);
                                    dte.ExecuteCommandForOpenDocument(artifact.LocalPath(), UndoCommand);
                                    Assert.IsNull(artifact.GetFreshComplexType("Sales_by_year_result"));
                                    Assert.IsNull(artifact.GetFreshFunctionImport("myfunctionimport"));
                                    dte.ExecuteCommandForOpenDocument(artifact.LocalPath(), RedoCommand);
                                    Assert.IsNotNull(artifact.GetFreshComplexType("Sales_by_year_result"));
                                    Assert.IsNotNull(artifact.GetFreshFunctionImport("myfunctionimport"));
                                    Assert.AreEqual(
                                        "Collection(NorthwindModel.Sales_by_year_result)",
                                        ((SingleItemBinding<ComplexType>)artifact.GetFreshFunctionImport("myfunctionimport").ReturnType)
                                            .RefName);
                                    CommandProcessor.InvokeSingleCommand(
                                        commandProcessorContext,
                                        new CreateFunctionImportCommand(
                                            artifact.GetFreshConceptualEntityContainer("NorthwindEntities"),
                                            artifact.GetFreshStorageFunction("GetFreightCost"),
                                            "myfunctionimport2",
                                            "String"));
                                    Assert.IsNotNull(artifact.GetFreshFunctionImport("myfunctionimport2"));
                                    Assert.AreEqual(
                                        "Collection(String)",
                                        ((DefaultableValue<String>)artifact.GetFreshFunctionImport("myfunctionimport2").ReturnType).Value);
                                    createComplexTypeCmd = new CreateComplexTypeCommand("GetFreightCost_result", true);
                                    commandProcessor.EnqueueCommand(createComplexTypeCmd);
                                    commandProcessor.EnqueueCommand(
                                        new ChangeFunctionImportCommand(
                                            artifact.GetFreshConceptualEntityContainer("NorthwindEntities"),
                                            artifact.GetFreshFunctionImport("myfunctionimport2"),
                                            artifact.GetFreshStorageFunction("GetFreightCost"),
                                            "test123",
                                             BoolOrNone.FalseValue,
                                            createComplexTypeCmd));
                                    commandProcessor.Invoke();
                                    Assert.IsNull(artifact.GetFreshFunctionImport("myfunctionimport2"));
                                    Assert.IsNotNull(artifact.GetFreshFunctionImport("test123"));
                                    Assert.AreEqual(
                                        "Collection(NorthwindModel.GetFreightCost_result)",
                                        ((SingleItemBinding<ComplexType>)artifact.GetFreshFunctionImport("test123").ReturnType).RefName);
                                    Assert.IsNotNull(artifact.GetFreshComplexType("GetFreightCost_result"));
                                    dte.ExecuteCommandForOpenDocument(artifact.LocalPath(), UndoCommand);
                                    Assert.IsNull(artifact.GetFreshFunctionImport("test123"));
                                    Assert.IsNotNull(artifact.GetFreshFunctionImport("myfunctionimport2"));
                                    Assert.AreEqual(
                                        "Collection(String)",
                                        ((DefaultableValue<String>)artifact.GetFreshFunctionImport("myfunctionimport2").ReturnType).Value);
                                    dte.ExecuteCommandForOpenDocument(artifact.LocalPath(), RedoCommand);
                                    Assert.IsNull(artifact.GetFreshFunctionImport("myfunctionimport2"));
                                    Assert.IsNotNull(artifact.GetFreshFunctionImport("test123"));
                                    Assert.AreEqual(
                                        "Collection(NorthwindModel.GetFreightCost_result)",
                                        ((SingleItemBinding<ComplexType>)artifact.GetFreshFunctionImport("test123").ReturnType).RefName);
                                    Assert.IsNotNull(artifact.GetFreshComplexType("GetFreightCost_result"));
                                });
                    });
        }
[ TestMethod ] [ HostType ( " " ) ] public void FunctionImportReturnComplexType ( ) { UITestRunner . Execute ( TestContext . TestName , ( ) => { const string testName = " " ; ExecuteUndoRedoTest ( testName , " " , ( commandProcessorContext , artifact ) => { var dte = VsIdeTestHostContext . Dte ; var commandProcessor = new CommandProcessor ( commandProcessorContext ) ; var createComplexTypeCmd = new CreateComplexTypeCommand ( " " , true ) ; commandProcessor . EnqueueCommand ( createComplexTypeCmd ) ; commandProcessor . EnqueueCommand ( new CreateComplexTypePropertyCommand ( " " , createComplexTypeCmd , " " , false ) ) ; commandProcessor . EnqueueCommand ( new CreateFunctionImportCommand ( artifact . GetFreshConceptualEntityContainer ( " " ) , artifact . GetFreshStorageFunction ( " " ) , " " , createComplexTypeCmd ) ) ; commandProcessor . Invoke ( ) ; Assert . IsNotNull ( artifact . GetFreshComplexType ( " " ) ) ; Assert . IsNotNull ( artifact . GetFreshComplexType ( " " ) ) ; Assert . IsNotNull ( artifact . GetFreshFunctionImport ( " " ) ) ; Assert . AreEqual ( " " , ( ( SingleItemBinding < ComplexType > ) artifact . GetFreshFunctionImport ( " " ) . ReturnType ) . RefName ) ; dte . ExecuteCommandForOpenDocument ( artifact . LocalPath ( ) , UndoCommand ) ; Assert . IsNull ( artifact . GetFreshComplexType ( " " ) ) ; Assert . IsNull ( artifact . GetFreshFunctionImport ( " " ) ) ; dte . ExecuteCommandForOpenDocument ( artifact . LocalPath ( ) , RedoCommand ) ; Assert . IsNotNull ( artifact . GetFreshComplexType ( " " ) ) ; Assert . IsNotNull ( artifact . GetFreshFunctionImport ( " " ) ) ; Assert . AreEqual ( " " , ( ( SingleItemBinding < ComplexType > ) artifact . GetFreshFunctionImport ( " " ) . ReturnType ) . RefName ) ; CommandProcessor . InvokeSingleCommand ( commandProcessorContext , new CreateFunctionImportCommand ( artifact . GetFreshConceptualEntityContainer ( " " ) , artifact . GetFreshStorageFunction ( " " ) , " " , " " ) ) ; Assert . IsNotNull ( artifact . GetFreshFunctionImport ( " " ) ) ; Assert . AreEqual ( " " , ( ( DefaultableValue < String > ) artifact . GetFreshFunctionImport ( " " ) . ReturnType ) . Value ) ; createComplexTypeCmd = new CreateComplexTypeCommand ( " " , true ) ; commandProcessor . EnqueueCommand ( createComplexTypeCmd ) ; commandProcessor . EnqueueCommand ( new ChangeFunctionImportCommand ( artifact . GetFreshConceptualEntityContainer ( " " ) , artifact . GetFreshFunctionImport ( " " ) , artifact . GetFreshStorageFunction ( " " ) , " " , BoolOrNone . FalseValue , createComplexTypeCmd ) ) ; commandProcessor . Invoke ( ) ; Assert . IsNull ( artifact . GetFreshFunctionImport ( " " ) ) ; Assert . IsNotNull ( artifact . GetFreshFunctionImport ( " " ) ) ; Assert . AreEqual ( " " , ( ( SingleItemBinding < ComplexType > ) artifact . GetFreshFunctionImport ( " " ) . ReturnType ) . RefName ) ; Assert . IsNotNull ( artifact . GetFreshComplexType ( " " ) ) ; dte . ExecuteCommandForOpenDocument ( artifact . LocalPath ( ) , UndoCommand ) ; Assert . IsNull ( artifact . GetFreshFunctionImport ( " " ) ) ; Assert . IsNotNull ( artifact . GetFreshFunctionImport ( " " ) ) ; Assert . AreEqual ( " " , ( ( DefaultableValue < String > ) artifact . GetFreshFunctionImport ( " " ) . ReturnType ) . Value ) ; dte . ExecuteCommandForOpenDocument ( artifact . LocalPath ( ) , RedoCommand ) ; Assert . IsNull ( artifact . GetFreshFunctionImport ( " " ) ) ; Assert . IsNotNull ( artifact . GetFreshFunctionImport ( " " ) ) ; Assert . AreEqual ( " " , ( ( SingleItemBinding < ComplexType > ) artifact . GetFreshFunctionImport ( " " ) . ReturnType ) . RefName ) ; Assert . IsNotNull ( artifact . GetFreshComplexType ( " " ) ) ; } ) ; } ) ; }
Create a function import returning a complex type then undo.
Create a function import returning a complex type then undo .
//Undo Redo Create FunctionImport /* isComposable */ // Undo redo "Change FunctionImport"