public void ZeroValueTest()
        {
            var resultReceiver   = new MockObjects.MockReceiver();
            var fibonacciCommand = new FibonacciSequenceCommand(resultReceiver);

            fibonacciCommand.Accept(new InputNumber {
                Value = 0
            });
            fibonacciCommand.Accept(new InputNumber {
                Value = 0
            });
            fibonacciCommand.Execute();
            Assert.AreEqual(0, resultReceiver.OutResult.Value);
        }
Exemplo n.º 2
0
        private static ICommand GetFibonacciCommand()
        {
            var fibbonacciReceiver = new DefaultResultReceiver();
            var fibonacciCommand   = new FibonacciSequenceCommand(fibbonacciReceiver);

            fibonacciCommand.Accept(new InputNumber {
                Value = 0
            });
            fibonacciCommand.Accept(new InputNumber {
                Value = 1
            });
            fibonacciCommand.SetIterations(25);
            return(fibonacciCommand);
        }
        public void TwoOrMoreInputTest()
        {
            var resultReceiver   = new MockObjects.MockReceiver();
            var fibonacciCommand = new FibonacciSequenceCommand(resultReceiver);

            fibonacciCommand.Accept(new InputNumber {
                Value = 1
            });
            fibonacciCommand.Accept(new InputNumber {
                Value = 2
            });
            fibonacciCommand.Execute();
            Assert.IsNotNull(resultReceiver.OutResult);
        }