Ejemplo n.º 1
0
        public void TestProcessAction()
        {
            //Arrange
            Stack <double> myStack = new Stack <double>();

            myStack.Push(1);
            myStack.Push(2);

            var data = A.Fake <IDataHolder <double> >();
            var calc = A.Fake <ICalculatorFunctions>();

            A.CallTo(() => data.RemoveElement()).Invokes(() => myStack.Pop()).Returns(myStack.Peek());
            A.CallTo(() => data.InsertElement(A <double> .Ignored)).Invokes(() => myStack.Push(3));

            WCFCalculatorImpl service = new WCFCalculatorImpl(data, calc);

            //Act
            service.ProcessAction("+");

            //Assert
            Assert.AreEqual(1, myStack.Count);
            Assert.AreEqual(3, myStack.Peek());
        }