public MainViewModel() { _random = new Random(); _themeNames = Directory.GetFiles(@"Themes", "*.xaml"); CalculatorViewModel = new CalculatorViewModel(); ChangeThemeCommand = new ActionCommand(ChangeTheme); }
public void TestAdd() { var c = new CalculatorViewModel(); c.InputSymbol('2'); c.InputSymbol(','); c.InputSymbol('1'); c.AddCommand.Execute(); c.InputSymbol('2'); c.InputSymbol(','); c.InputSymbol('0'); c.EquateCommand.Execute(); Assert.IsTrue(Decimal.Equals(c.Result, 4.1M)); }
public void TestMultiply() { var c = new CalculatorViewModel(); c.InputSymbol('2'); c.InputSymbol(','); c.InputSymbol('0'); c.PlusMinusCommand.Execute(); c.MultiplyCommand.Execute(); c.InputSymbol('2'); c.InputSymbol(','); c.InputSymbol('0'); c.EquateCommand.Execute(); Assert.IsTrue(Decimal.Equals(c.Result, -4.0M)); }
public void TestAddSubtractAndEquate() { var c = new CalculatorViewModel(); c.InputSymbol('2'); c.InputSymbol(','); c.InputSymbol('1'); c.PlusMinusCommand.Execute(); c.AddCommand.Execute(); c.InputSymbol('2'); c.InputSymbol(','); c.InputSymbol('0'); c.SubtractCommand.Execute(); c.InputSymbol('2'); c.InputSymbol(','); c.InputSymbol('0'); c.EquateCommand.Execute(); Assert.IsTrue(Decimal.Equals(c.Result, -2.1M)); }
public void TestEmptyInput() { var c = new CalculatorViewModel(); c.Input = String.Empty; Assert.IsTrue(c.Input == "0"); }