Ejemplo n.º 1
0
        public void EqualsCommandInClearStateShouldBeInvariantTest()
        {
            var calc  = CalculatorFactory.BuildNew();
            var state = new ClearState(calc);

            state.Notify(new EqualsCommand());
            Assert.IsTrue(calc.State is ClearState);
        }
Ejemplo n.º 2
0
        public void PointCommandShouldSetAccumulatorTest()
        {
            var calc  = CalculatorFactory.BuildNew();
            var state = new ClearState(calc);

            Assert.IsTrue(calc.CPU.Accumulator.IsEmpty);
            state.Notify(PointCommand.Instance);
            Assert.IsTrue(calc.State is AccumulatorState);
            Assert.IsTrue(calc.CPU.Accumulator.ToString() == "0.");
        }