示例#1
0
        public void SimpleUndoRedo()
        {
            ExecuteMigrateDiagramNodesTest(
                "SimpleUndoRedo",
                (artifact, commandProcessorContext) =>
            {
                var baseType =
                    (ConceptualEntityType)
                    CreateEntityTypeCommand.CreateEntityTypeAndEntitySetWithDefaultNames(commandProcessorContext);
                var derivedType = CreateEntityTypeCommand.CreateDerivedEntityType(
                    commandProcessorContext, "SubType", baseType, true);

                Dte.ExecuteCommandForOpenDocument(artifact.LocalPath(), "Edit.Undo");
                Assert.IsTrue(!artifact.ConceptualModel.EntityTypes().Any(et => et.LocalName.Value == derivedType.LocalName.Value));

                Dte.ExecuteCommandForOpenDocument(artifact.LocalPath(), "Edit.Undo");
                Assert.IsTrue(!artifact.ConceptualModel.EntityTypes().Any(et => et.LocalName.Value == baseType.LocalName.Value));

                Dte.ExecuteCommandForOpenDocument(artifact.LocalPath(), "Edit.Redo");
                Dte.ExecuteCommandForOpenDocument(artifact.LocalPath(), "Edit.Redo");

                Assert.IsNotNull(
                    artifact.ConceptualModel.EntityTypes().SingleOrDefault(et => et.LocalName.Value == baseType.LocalName.Value));

                // Verify that derived type and inheritance are recreated.
                derivedType =
                    (ConceptualEntityType)
                    artifact.ConceptualModel.EntityTypes().SingleOrDefault(et => et.LocalName.Value == derivedType.LocalName.Value);
                Assert.IsNotNull(derivedType);
                Assert.AreEqual(baseType.LocalName.Value, derivedType.BaseType.Target.LocalName.Value);
            });
        }
示例#2
0
 internal override void Invoke(CommandProcessorContext cpc)
 {
     CreateEntityTypeCommand.CreateEntityTypeAndEntitySetWithDefaultNames(cpc);
 }