public void CanExecuteCalculateCommand() { CalcViewModel viewModel = new CalcViewModel(); ICommand command = viewModel.CalcCommand; command.Execute(null); }
public void CanInputSum() { CalcViewModel viewModel = new CalcViewModel(); viewModel.Input = "1+1"; Assert.AreEqual("1+1", viewModel.Input); }
public void CanExecuteCalculateCommandFiveTimeSeven() { CalcViewModel viewModel = new CalcViewModel(); viewModel.Input = "5*7"; ICommand command = viewModel.CalcCommand; command.Execute(null); Assert.AreEqual(35, viewModel.Result); }
public void CanExecuteCalculateCommandTwoPlusTwo() { CalcViewModel viewModel = new CalcViewModel(); viewModel.Input = "2+2"; ICommand command = viewModel.CalcCommand; command.Execute(null); Assert.AreEqual(4, viewModel.Result); }
public void ResultChangedNotificationIsFired() { CalcViewModel viewModel = new CalcViewModel(); bool hasFired = false; viewModel.PropertyChanged += (sender, args) => { if (args.PropertyName == "Result") { hasFired = true; } }; viewModel.Input = "5*7"; ICommand command = viewModel.CalcCommand; command.Execute(null); Assert.IsTrue(hasFired); }
public AddCharCommand(CalcViewModel viewModel) { this.viewModel = viewModel; }
public CalcCommand(CalcViewModel viewModel) { this.viewModel = viewModel; }
public OperationCommand(CalcViewModel viewModel) { this.viewModel = viewModel; }
public DeleteCharCommand(CalcViewModel viewModel) { this.viewModel = viewModel; }
public void CanCreateViewModel() { CalcViewModel viewModel = new CalcViewModel(); }