private void BoundaryTest(char heading, ErrorCode ec) { var rover = new PessimisticRover(new ParsedRoverCommand($"1 1 {heading}", "MMM")); var rovers = new List <BaseRover>(); var bounds = new Coordinant(2, 2); ErrorCode?result = rover.DoCommand('M', bounds, rovers); Assert.IsNull(result); result = rover.DoCommand('M', bounds, rovers); Assert.IsTrue(result.HasValue); Assert.IsTrue(result.Value == ec); }
public void TestRoverCollision() { var rover = new PessimisticRover(new ParsedRoverCommand("1 1 N", "MMM")); var rovers = new List <BaseRover>() { new PessimisticRover(new ParsedRoverCommand("1 3 N", "M")) }; var bounds = new Coordinant(3, 3); ErrorCode?result = rover.DoCommand('M', bounds, rovers); Assert.IsNull(result); result = rover.DoCommand('M', bounds, rovers); Assert.IsTrue(result.HasValue); Assert.IsTrue(result.Value == ErrorCode.Unexpected_Drone); }