public CalculatorViewModel() { NumberCommand = new RelayCommand(param => { calculator.Number(Convert.ToInt32(param)); UpdateDisplay(); }, param => calculator.CanDoNumber()); PlusCommand = new RelayCommand(param => { calculator.Plus(); UpdateDisplay(); }, param => calculator.CanDoSign()); MinusCommand = new RelayCommand(param => { calculator.Minus(); UpdateDisplay(); }, param => calculator.CanDoSign()); TimesCommand = new RelayCommand(param => { calculator.Times(); UpdateDisplay(); }, param => calculator.CanDoSign()); OverCommand = new RelayCommand(param => { calculator.Over(); UpdateDisplay(); }, param => calculator.CanDoSign()); EqualsCommand = new RelayCommand(param => { calculator.Equals(); UpdateDisplay(); }, param => calculator.CanDoEquals()); ClearCommand = new RelayCommand(param => { calculator.Clear(); UpdateDisplay(); }, param => calculator.CanDoClear()); }
public void TestCantDoOperatorInitially() { Assert.False(calculator.CanDoSign()); }