Exemple #1
0
        public void MainVindow_DotButtonIsPassed()
        {
            calc.Stub(c => c.CalculatorState).Return(CalculatorState.SCREEN_VIEW);
            calc.Stub(c => c.ScreenText).Return("2");
            calc.dotButtonPressed();
            mocks.ReplayAll();

            viewModel.DotButtonCommand.Execute(null);
            mocks.VerifyAll();
        }
 public MainWindowViewModel(ICalculatorFacade calculator)
 {
     this.calculator         = calculator;
     screenText              = "0";
     NumericButtonCommand    = createActionCommand((string a) => NumericButtonClicked(a));
     DotButtonCommand        = createActionCommand(() => calculator.dotButtonPressed());
     SignButtonCommand       = createActionCommand(() => calculator.invertSignButtonPressed());
     DivideButtonCommand     = createActionCommand(() => calculator.operatorButtonPressed(CalculatorOperator.DIVIDE));
     MultiplyButtonCommand   = createActionCommand(() => calculator.operatorButtonPressed(CalculatorOperator.MULTIPLY));
     SubtractButtonCommand   = createActionCommand(() => calculator.operatorButtonPressed(CalculatorOperator.SUBTRACT));
     AddButtonCommand        = createActionCommand(() => calculator.operatorButtonPressed(CalculatorOperator.ADD));
     CancelButtonCommand     = createActionCommand(() => calculator.clearButtonPressed());
     SquareRootButtonCommand = createActionCommand(() => calculator.squareRootButtonPressed());
     PercentButtonCommand    = createActionCommand(() => calculator.percentButtonPressed());
     EqualButtonCommand      = createActionCommand(() => calculator.equalButtonPressed());
 }