public void SetsNewValue()
            {
                var obj = new MockModel { Value = "currentValue" };

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

                Assert.AreEqual("nextValue", obj.Value);
            }
            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);
            }
Example #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);
            }