test/Misc/EFTools/InProcTests/UndoRedoTestsRemote.cs
/// <summary>
///     General mapping tests on blank model
///     1. Undo/Redo Creation of EntitySetMapping on blank model (should create EntityContainerMapping)
///     2. Undo/Redo Create two Entity Type Mappings within same Entity Set Mapping (TPH)
/// </summary>
General mapping tests on blank model
1. Undo/Redo Creation of EntitySetMapping on blank model (should create EntityContainerMapping)
2. Undo/Redo Create two Entity Type Mappings within same Entity Set Mapping (TPH)
General mapping tests on blank model 1 . Undo / Redo Creation of EntitySetMapping on blank model ( should create EntityContainerMapping ) 2 . Undo / Redo Create two Entity Type Mappings within same Entity Set Mapping ( TPH )
[TestMethod]
        [HostType("VS IDE")]
        public void Mapping_General_Blank()
        {
            UITestRunner.Execute(TestContext.TestName, 
                () =>
                    {
                        const string typePrefix = "Mapping_General_Blank";
                        const string testName = "UndoRedo." + typePrefix;
                        ExecuteUndoRedoTest(
                            testName, "BlankModel.edmx", (commandProcessorContext, artifact) =>
                                {
                                    const string entityType1Name = typePrefix + "_EntityType1";
                                    const string entityType2Name = typePrefix + "_EntityType2";
                                    const string entitySetName = typePrefix + "_EntitySet";
                                    var dte = VsIdeTestHostContext.Dte;
                                    CreateDefaultEntityType(commandProcessorContext, entityType1Name, entitySetName);
                                    CreateEntityTypeCommand.CreateConceptualEntityTypeAndEntitySetAndProperty(
                                        commandProcessorContext,
                                        entityType2Name,
                                        entitySetName,
                                         false,
                                        null,
                                        null,
                                        null,
                                         true);
                                    new CommandProcessor(
                                        commandProcessorContext,
                                        new CreateInheritanceCommand(
                                            artifact.GetFreshConceptualEntity(entityType2Name),
                                            artifact.GetFreshConceptualEntity(entityType1Name))).Invoke();
                                    var commandProcessor = new CommandProcessor(commandProcessorContext);
                                    commandProcessor.EnqueueCommand(
                                        new CreateEntityTypeMappingCommand(artifact.GetFreshConceptualEntity(entityType1Name)));
                                    commandProcessor.EnqueueCommand(
                                        new CreateEntityTypeMappingCommand(artifact.GetFreshConceptualEntity(entityType2Name)));
                                    commandProcessor.Invoke();
                                    Assert.AreEqual(2, artifact.GetFreshEntitySetMapping(entitySetName).EntityTypeMappings().Count);
                                    dte.ExecuteCommandForOpenDocument(artifact.LocalPath(), UndoCommand);
                                    Assert.IsNull(artifact.GetFreshEntitySetMapping(entitySetName));
                                    Assert.IsNotNull(artifact.GetFreshConceptualEntity(entityType1Name));
                                    Assert.IsNotNull(artifact.GetFreshConceptualEntity(entityType2Name));
                                    dte.ExecuteCommandForOpenDocument(artifact.LocalPath(), RedoCommand);
                                    Assert.AreEqual(2, artifact.GetFreshEntitySetMapping(entitySetName).EntityTypeMappings().Count);
                                });
                    });
        }
[ TestMethod ] [ HostType ( " " ) ] public void Mapping_General_Blank ( ) { UITestRunner . Execute ( TestContext . TestName , ( ) => { const string typePrefix = " " ; const string testName = " " + typePrefix ; ExecuteUndoRedoTest ( testName , " " , ( commandProcessorContext , artifact ) => { const string entityType1Name = typePrefix + " " ; const string entityType2Name = typePrefix + " " ; const string entitySetName = typePrefix + " " ; var dte = VsIdeTestHostContext . Dte ; CreateDefaultEntityType ( commandProcessorContext , entityType1Name , entitySetName ) ; CreateEntityTypeCommand . CreateConceptualEntityTypeAndEntitySetAndProperty ( commandProcessorContext , entityType2Name , entitySetName , false , null , null , null , true ) ; new CommandProcessor ( commandProcessorContext , new CreateInheritanceCommand ( artifact . GetFreshConceptualEntity ( entityType2Name ) , artifact . GetFreshConceptualEntity ( entityType1Name ) ) ) . Invoke ( ) ; var commandProcessor = new CommandProcessor ( commandProcessorContext ) ; commandProcessor . EnqueueCommand ( new CreateEntityTypeMappingCommand ( artifact . GetFreshConceptualEntity ( entityType1Name ) ) ) ; commandProcessor . EnqueueCommand ( new CreateEntityTypeMappingCommand ( artifact . GetFreshConceptualEntity ( entityType2Name ) ) ) ; commandProcessor . Invoke ( ) ; Assert . AreEqual ( 2 , artifact . GetFreshEntitySetMapping ( entitySetName ) . EntityTypeMappings ( ) . Count ) ; dte . ExecuteCommandForOpenDocument ( artifact . LocalPath ( ) , UndoCommand ) ; Assert . IsNull ( artifact . GetFreshEntitySetMapping ( entitySetName ) ) ; Assert . IsNotNull ( artifact . GetFreshConceptualEntity ( entityType1Name ) ) ; Assert . IsNotNull ( artifact . GetFreshConceptualEntity ( entityType2Name ) ) ; dte . ExecuteCommandForOpenDocument ( artifact . LocalPath ( ) , RedoCommand ) ; Assert . AreEqual ( 2 , artifact . GetFreshEntitySetMapping ( entitySetName ) . EntityTypeMappings ( ) . Count ) ; } ) ; } ) ; }
General mapping tests on blank model
1.
General mapping tests on blank model 1 .
/*createKeyProperty*/ /*uniquifyNames*/ // CREATE TWO ENTITY TYPE MAPPINGS WITHIN THE SAME ENTITY SET MAPPING // Undo redo "Create two EntityTypeMappings within same EntitySetMapping"