Ejemplo n.º 1
0
        public void ApplyCollectionInsertionComposition()
        {
            var toInsert = new Route();

            var change = new CompositionCollectionInsertion
            {
                AffectedElement = railway,
                Feature         = RailwayContainer.ClassInstance.LookupReference("routes"),
                AddedElement    = toInsert
            };

            change.Apply();

            Assert.AreEqual(toInsert, railway.Routes.Last());
        }
Ejemplo n.º 2
0
        public void InvertCollectionInsertionComposition()
        {
            var toInsert = new Route();

            var change = new CompositionCollectionInsertion
            {
                AffectedElement = railway1,
                Feature         = RailwayContainer.ClassInstance.LookupReference("routes"),
                AddedElement    = toInsert
            };

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

            CollectionAssert.DoesNotContain(railway1.Routes.ToList(), toInsert);
            Assert.AreEqual(railway1.Routes.Count, railway2.Routes.Count);
        }