public void SML_Instruction_Notequ_Bad_Stack_Items() { string[] inputOpcodes = new string[] { "5", "addone" }; Stack stack = new Stack(); Mock <IVirtualMachine> mock = new Mock <IVirtualMachine>(MockBehavior.Strict); Notequ notequ = new Notequ { VirtualMachine = mock.Object, Operands = inputOpcodes }; mock.Setup(m => m.Stack).Returns(stack); mock.Setup(m => m.SwapBranch(It.IsAny <string>())); notequ.Run(); }
public void SML_Instruction_Notequ_Bad_Item() { string[] inputOpcodes = new string[] { "2" }; int inputOne = 2; string inputTwo = "1"; Stack stack = new Stack(); Mock <IVirtualMachine> mock = new Mock <IVirtualMachine>(MockBehavior.Strict); Notequ notequ = new Notequ { VirtualMachine = mock.Object, Operands = inputOpcodes }; mock.Setup(m => m.Stack).Returns(stack); mock.Setup(m => m.SwapBranch(It.IsAny <string>())); stack.Push(inputOne); stack.Push(inputTwo); notequ.Run(); }
public void SML_Instruction_Notequ_Good_None() { string[] inputOpcodes = new string[] { "addone" }; int inputOne = 2; int inputTwo = 2; Stack stack = new Stack(); Mock <IVirtualMachine> mock = new Mock <IVirtualMachine>(MockBehavior.Strict); Notequ notequ = new Notequ { VirtualMachine = mock.Object, Operands = inputOpcodes }; mock.Setup(m => m.Stack).Returns(stack); mock.Setup(m => m.SwapBranch(It.IsAny <string>())); stack.Push(inputOne); stack.Push(inputTwo); notequ.Run(); mock.Verify(m => m.SwapBranch(It.IsAny <string>()), Times.Never); }