예제 #1
0
        public void ApplyListDeletionAssociation()
        {
            var parent   = railway.Routes[0].DefinedBy[0].Elements[0];
            var toDelete = parent.ConnectsTo[0];

            var change = new AssociationListDeletion
            {
                AffectedElement = parent,
                Feature         = TrackElement.ClassInstance.LookupReference("connectsTo"),
                Index           = 0
            };

            change.Apply();

            Assert.AreNotEqual(toDelete, parent.ConnectsTo.FirstOrDefault());
            CollectionAssert.DoesNotContain(parent.ConnectsTo.ToList(), toDelete);
        }
예제 #2
0
        public void InvertListDeletionAssociation()
        {
            var parent1  = railway1.Routes[0].DefinedBy[0].Elements[0];
            var parent2  = railway1.Routes[0].DefinedBy[0].Elements[0];
            var toDelete = parent1.ConnectsTo[0];

            var change = new AssociationListDeletion
            {
                AffectedElement = parent1,
                Feature         = TrackElement.ClassInstance.LookupReference("connectsTo"),
                Index           = 0,
                DeletedElement  = toDelete
            };

            change.Apply();
            foreach (var inverted in change.Invert())
            {
                inverted.Apply();
            }

            Assert.AreEqual(parent1.ConnectsTo.Count, parent2.ConnectsTo.Count);
            CollectionAssert.Contains(parent1.ConnectsTo.ToList(), toDelete);
        }