Exemplo n.º 1
0
            public void Should_halt_on_InstructionDecodeError()
            {
                InstructionDecoderMock
                .Setup(x => x.Decode(It.IsAny <ComputerState>()))
                .Callback((ComputerState state) =>
                {
                    state.InstructionDecodeError = true;
                    state.Halt = true;
                });

                Computer.State.Memory = new[] { 0 };

                Computer.Run();

                Assert.True(Computer.State.Halt, "Not halted.");
            }
Exemplo n.º 2
0
            public void Should_stop_execution_on_halt()
            {
                InstructionDecoderMock
                .Setup(x => x.Decode(It.IsAny <ComputerState>()))
                .Callback((ComputerState state) =>
                {
                    state.Instruction = new Halt();
                });

                Computer.State.Memory = new[] { 0 };

                AssertAsync
                .CompletesIn(1, () => Computer.Run())
                .Wait();

                Assert.True(Computer.State.Halt, "Not halted.");
            }