test/Misc/EFTools/InProcTests/UndoRedoTestsRemote.cs
/// <summary>
///     Delete "Orders" EntityType from Northwind model and undo - all NavigationProperties should be resolved
/// </summary>
Delete "Orders" EntityType from Northwind model and undo - all NavigationProperties should be resolved
Delete " Orders " EntityType from Northwind model and undo - all NavigationProperties should be resolved
[TestMethod]
        [HostType("VS IDE")]
        public void TestBug634186()
        {
            UITestRunner.Execute(TestContext.TestName, 
                () =>
                    {
                        const string testName = "UndoRedo.TestBug634186";
                        ExecuteUndoRedoTest(
                            testName, "NorthwindModel.edmx", (commandProcessorContext, artifact) =>
                                {
                                    var dte = VsIdeTestHostContext.Dte;
                                    CommandProcessor.InvokeSingleCommand(
                                        commandProcessorContext,
                                        artifact.GetFreshConceptualEntity("Orders").GetDeleteCommand());
                                    Assert.IsNull(artifact.GetFreshConceptualEntitySet("Orders"));
                                    Assert.IsNull(artifact.GetFreshConceptualEntity("Orders"));
                                    Assert.IsTrue(
                                        !artifact.ConceptualModel()
                                             .EntityTypes().SelectMany(e => ((ConceptualEntityType)e).NavigationProperties())
                                             .Any(p => p.Name.Value == "Orders"));
                                    Assert.IsTrue(
                                        !artifact.ConceptualModel()
                                             .EntityContainers().Single()
                                             .AssociationSets()
                                             .SelectMany(a => a.AssociationSetEnds())
                                             .Any(e => e.EntitySet.RefName == "Orders"));
                                    dte.ExecuteCommandForOpenDocument(artifact.LocalPath(), UndoCommand);
                                    var props = artifact.ConceptualModel().EntityTypes().SelectMany(e => e.Properties());
                                    Assert.IsNotNull(artifact.GetFreshConceptualEntitySet("Orders"));
                                    Assert.IsNotNull(artifact.GetFreshConceptualEntity("Orders"));
                                    Assert.IsTrue(
                                        artifact.ConceptualModel()
                                            .EntityTypes().SelectMany(e => ((ConceptualEntityType)e).NavigationProperties())
                                            .Any(p => p.Name.Value == "Orders"));
                                    Assert.IsTrue(
                                        artifact.ConceptualModel()
                                            .EntityContainers().Single()
                                            .AssociationSets()
                                            .SelectMany(a => a.AssociationSetEnds())
                                            .Any(e => e.EntitySet.RefName == "Orders"));
                                    dte.ExecuteCommandForOpenDocument(artifact.LocalPath(), RedoCommand);
                                    Assert.IsNull(artifact.GetFreshConceptualEntitySet("Orders"));
                                    Assert.IsNull(artifact.GetFreshConceptualEntity("Orders"));
                                    Assert.IsTrue(
                                        !artifact.ConceptualModel()
                                             .EntityTypes().SelectMany(e => ((ConceptualEntityType)e).NavigationProperties())
                                             .Any(p => p.Name.Value == "Orders"));
                                    Assert.IsTrue(
                                        !artifact.ConceptualModel()
                                             .EntityContainers().Single()
                                             .AssociationSets()
                                             .SelectMany(a => a.AssociationSetEnds())
                                             .Any(e => e.EntitySet.RefName == "Orders"));
                                });
                    });
        }
[ TestMethod ] [ HostType ( " " ) ] public void TestBug634186 ( ) { UITestRunner . Execute ( TestContext . TestName , ( ) => { const string testName = " " ; ExecuteUndoRedoTest ( testName , " " , ( commandProcessorContext , artifact ) => { var dte = VsIdeTestHostContext . Dte ; CommandProcessor . InvokeSingleCommand ( commandProcessorContext , artifact . GetFreshConceptualEntity ( " " ) . GetDeleteCommand ( ) ) ; Assert . IsNull ( artifact . GetFreshConceptualEntitySet ( " " ) ) ; Assert . IsNull ( artifact . GetFreshConceptualEntity ( " " ) ) ; Assert . IsTrue ( ! artifact . ConceptualModel ( ) . EntityTypes ( ) . SelectMany ( e => ( ( ConceptualEntityType ) e ) . NavigationProperties ( ) ) . Any ( p => p . Name . Value == " " ) ) ; Assert . IsTrue ( ! artifact . ConceptualModel ( ) . EntityContainers ( ) . Single ( ) . AssociationSets ( ) . SelectMany ( a => a . AssociationSetEnds ( ) ) . Any ( e => e . EntitySet . RefName == " " ) ) ; dte . ExecuteCommandForOpenDocument ( artifact . LocalPath ( ) , UndoCommand ) ; var props = artifact . ConceptualModel ( ) . EntityTypes ( ) . SelectMany ( e => e . Properties ( ) ) ; Assert . IsNotNull ( artifact . GetFreshConceptualEntitySet ( " " ) ) ; Assert . IsNotNull ( artifact . GetFreshConceptualEntity ( " " ) ) ; Assert . IsTrue ( artifact . ConceptualModel ( ) . EntityTypes ( ) . SelectMany ( e => ( ( ConceptualEntityType ) e ) . NavigationProperties ( ) ) . Any ( p => p . Name . Value == " " ) ) ; Assert . IsTrue ( artifact . ConceptualModel ( ) . EntityContainers ( ) . Single ( ) . AssociationSets ( ) . SelectMany ( a => a . AssociationSetEnds ( ) ) . Any ( e => e . EntitySet . RefName == " " ) ) ; dte . ExecuteCommandForOpenDocument ( artifact . LocalPath ( ) , RedoCommand ) ; Assert . IsNull ( artifact . GetFreshConceptualEntitySet ( " " ) ) ; Assert . IsNull ( artifact . GetFreshConceptualEntity ( " " ) ) ; Assert . IsTrue ( ! artifact . ConceptualModel ( ) . EntityTypes ( ) . SelectMany ( e => ( ( ConceptualEntityType ) e ) . NavigationProperties ( ) ) . Any ( p => p . Name . Value == " " ) ) ; Assert . IsTrue ( ! artifact . ConceptualModel ( ) . EntityContainers ( ) . Single ( ) . AssociationSets ( ) . SelectMany ( a => a . AssociationSetEnds ( ) ) . Any ( e => e . EntitySet . RefName == " " ) ) ; } ) ; } ) ; }
Delete "Orders" EntityType from Northwind model and undo - all NavigationProperties should be resolved
Delete " Orders " EntityType from Northwind model and undo - all NavigationProperties should be resolved