protected void SetProperty <T>(ref T model, Action setter, [CallerMemberName] string propertyName = null) { var oldState = model; setter(); RaisePropertyChanged(propertyName); UndoService.AddUndoState(this, propertyName, oldState, model); }
public void UndoService_AddUndoState_AddsStateToUndoStates() { //arrange var testViewModel = new TestViewModel(); //act UndoService.AddUndoState(testViewModel, propertyName, 1, 2); var state = UndoService.GetWindowPreviousState; //assert Assert.AreEqual(testViewModel, state.viewModel); Assert.AreEqual(propertyName, state.propertyName); Assert.AreEqual(1, state.oldState); Assert.AreEqual(2, state.newState); }