Ejemplo n.º 1
0
        public void ApplyListInsertionAssociation()
        {
            var parent   = railway.Routes[0].DefinedBy[0].Elements[0];
            var toInsert = railway.Routes[0].DefinedBy[1].Elements[0];

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

            change.Apply();

            Assert.AreSame(toInsert, parent.ConnectsTo[0]);
        }
Ejemplo n.º 2
0
        public void InvertListInsertionAssociation()
        {
            var parent1  = railway1.Routes[0].DefinedBy[0].Elements[0];
            var parent2  = railway2.Routes[0].DefinedBy[0].Elements[0];
            var toInsert = railway1.Routes[0].DefinedBy[1].Elements[0];

            var change = new AssociationListInsertion
            {
                AffectedElement = parent1,
                Feature         = TrackElement.ClassInstance.LookupReference("connectsTo"),
                Index           = 0,
                AddedElement    = toInsert
            };

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

            Assert.AreNotSame(toInsert, parent1.ConnectsTo[0]);
            Assert.AreEqual(parent1.ConnectsTo.Count, parent2.ConnectsTo.Count);
        }