public void Reset(double Number) { CurrentValue = Number; InputWaited = WaitedInput.Action; _Right = null; Action = null; }
private void TestWithNull(ICalculatorAction Action) { try { Action.Calculate(10, null); Assert.Fail("должна была произойти ошибка, т.к. второй аргумент null"); } catch (Exception) { } }
private void ExecuteAction() { if (Action == null) throw new Exception("action not set"); CurrentValue = Action.Calculate(CurrentValue, _Right); _Right = null; Action = null; InputWaited = WaitedInput.Action; }
public void InputAction(ICalculatorAction Action) { if (InputWaited != WaitedInput.Action) throw new Exception("action input requered"); if (Action == null) throw new ArgumentNullException("Action"); this.Action = Action; if (Action.Unary) ExecuteAction(); else InputWaited = WaitedInput.Numeric; }