예제 #1
0
        public void SML_Instruction_Incr_Bad_Stack()
        {
            Mock <IVirtualMachine> mock = new Mock <IVirtualMachine>(MockBehavior.Strict);
            Incr incr = new Incr
            {
                VirtualMachine = mock.Object
            };

            mock.Setup(m => m.Stack).Returns(new Stack());

            incr.Run();
        }
예제 #2
0
        public void SML_Instruction_Incr_Bad_Item()
        {
            string inputOne = "2";

            Stack stack = new Stack();
            Mock <IVirtualMachine> mock = new Mock <IVirtualMachine>(MockBehavior.Strict);
            Incr incr = new Incr
            {
                VirtualMachine = mock.Object
            };

            mock.Setup(m => m.Stack).Returns(stack);

            stack.Push(inputOne);

            incr.Run();
        }
예제 #3
0
        public void SML_Instruction_Incr_Good()
        {
            int inputOne = 2;
            int expected = inputOne + 1;

            Stack stack = new Stack();
            Mock <IVirtualMachine> mock = new Mock <IVirtualMachine>(MockBehavior.Strict);
            Incr incr = new Incr
            {
                VirtualMachine = mock.Object
            };

            mock.Setup(m => m.Stack).Returns(stack);

            stack.Push(inputOne);

            incr.Run();

            Assert.AreEqual(mock.Object.Stack.Pop(), expected);
        }