Ejemplo n.º 1
0
            public void SetsNewValue()
            {
                var obj = new MockModel { Value = "currentValue" };

                var propertyChangeUndo = new PropertyChangeUndo(obj, "Value", "previousValue", "nextValue");
                propertyChangeUndo.Redo();

                Assert.AreEqual("nextValue", obj.Value);
            }
Ejemplo n.º 2
0
            public void SetsValuesCorrectly()
            {
                var obj = new { MyProperty = "currentValue" };

                var propertyChangeUndo = new PropertyChangeUndo(obj, "MyProperty", "currentValue", "nextValue");
                Assert.AreEqual("currentValue", obj.MyProperty);
                Assert.AreEqual("MyProperty", propertyChangeUndo.PropertyName);
                Assert.AreEqual(obj, propertyChangeUndo.Target);
                Assert.AreEqual("currentValue", propertyChangeUndo.OldValue);
                Assert.AreEqual("nextValue", propertyChangeUndo.NewValue);
                Assert.AreEqual(true, propertyChangeUndo.CanRedo);
            }
Ejemplo n.º 3
0
            public void SetProperty()
            {
                var instance = new IniEntry();
                var action = new PropertyChangeUndo(instance, "Key", "previousValue", "nextValue");
                var mementoService = new MementoService();

                mementoService.Add(action);
                Assert.AreEqual(IniEntry.KeyProperty.GetDefaultValue(), instance.Key);

                mementoService.Undo();
                Assert.AreEqual("previousValue", instance.Key);

                mementoService.Redo();
                Assert.AreEqual("nextValue", instance.Key);
            }