public void ShouldntLostSecondTime(string initialState, string command) { Simulator simulator = new Simulator(); simulator.AddInstructionRange(new[] { "2 2", initialState, command, initialState, command }); Assert.DoesNotContain("LOST", simulator.GetOutput().Last()); }
public void TestMininalGrid() { Simulator simulator = new Simulator(); simulator.AddInstructionRange(new[] { "0 0", "0 0 E", "FRFRFRFRF", "0 0 N", "FRFLFFRFL" }); string expected = String.Join(Environment.NewLine, "0 0 E LOST", "0 0 N"); Assert.Equal(expected, String.Join(Environment.NewLine, simulator.GetOutput())); }
public void TestInputOutput() { Simulator simulator = new Simulator(); simulator.AddInstructionRange(new[] { "5 3", "1 1 E", "RFRFRFRF", "3 2 N", "FRRFLLFFRRFLL", "0 3 W", "LLFFFLFLFL" }); string expected = String.Join(Environment.NewLine, "1 1 E", "3 3 N LOST", "2 3 S"); Assert.Equal(expected, String.Join(Environment.NewLine, simulator.GetOutput())); }
public void ShouldFailWithException(params string[] input) { Simulator simulator = new Simulator(); Assert.ThrowsAny <Exception>(() => simulator.AddInstructionRange(input)); }