Пример #1
0
        public void CreateInstructionStackCalled_EmptyInstructionSet_Throws()
        {
            var instructionSet = "";

            Assert.Throws <InstructionsMissingError>(
                () => _sut.CreateInstructionStack(instructionSet));
        }
Пример #2
0
        public void AfterProgramExecution_BoardIsAsExpected()
        {
            var startState    = string.Join(null, _startState);
            var currentState  = _contextFactory.CreateInitialState(3, 3, startState, c => c);
            var instructions  = _instructionFactory.CreateInstructionStack(Program);
            var snapshot      = new ExecutionSnapshot <char>(instructions);
            var expectedState = string.Join(null, _expected);
            var expectedBoard = _contextFactory.CreateBoard(3, expectedState, EntryConverter);
            var verifier      = new BoardVerifier <char>(expectedBoard, EntryComparer);

            while (!snapshot.ExecutionFinished(currentState))
            {
                snapshot.ExecuteStep(currentState);
            }

            var result = verifier.Verify(currentState.Board);

            result.ShouldBeTrue();
        }