Ejemplo n.º 1
0
        public void ApplyPropertyChangeAttribute()
        {
            var parent   = railway.Routes.First().Entry;
            var newValue = Signal.FAILURE;
            var oldValue = repository.Resolve(parent.AbsoluteUri).GetType().GetProperty("Signal").GetValue(parent, null);

            var change = new AttributeChange
            {
                AffectedElement = parent,
                Feature         = Semaphore.ClassInstance.LookupAttribute("signal"),
                OldValue        = oldValue.ToString(),
                NewValue        = newValue.ToString()
            };

            change.Apply();

            Assert.AreEqual(newValue, parent.Signal);
        }
Ejemplo n.º 2
0
        public void InvertPropertyChangeAttribute()
        {
            var parent   = railway1.Routes.First().Entry;
            var newValue = Signal.FAILURE;
            var oldValue = repository1.Resolve(parent.AbsoluteUri).GetType().GetProperty("Signal").GetValue(parent, null);

            var change = new AttributeChange
            {
                AffectedElement = parent,
                Feature         = Semaphore.ClassInstance.Resolve(new Uri("signal", UriKind.Relative)) as ITypedElement,
                OldValue        = oldValue.ToString(),
                NewValue        = newValue.ToString()
            };

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

            Assert.AreEqual(oldValue, parent.Signal);
        }