public void TestPatrolLookAroundRestartPatrol() { RobotAi ai = new MockRobotAi(); MockRobot robot = (MockRobot)ai.Robot; robot.PatrolEnd = new MockLocation(0, 0, 0); robot.Target = robot.Location = robot.PatrolStart = new MockLocation(100, 100, 100); ai.State = RobotAiState.PatrolLookAround; ai.TimeMarker = DateTime.Now - TimeSpan.FromMinutes(10); ai.Think(); Assert.AreEqual(RobotAiState.Patrol, ai.State); Assert.True(robot.ReachedTarget()); }
public void TestPatrolTargetEndReached() { RobotAi ai = new MockRobotAi(); MockRobot robot = (MockRobot)ai.Robot; robot.Target = robot.Location = robot.PatrolEnd = new MockLocation(0, 0, 0); robot.PatrolStart = new MockLocation(100, 100, 100); ai.State = RobotAiState.PatrolMarchToEnd; ai.Think(); Assert.AreEqual(RobotAiState.PatrolLookAround, ai.State); Assert.AreEqual(new MockLocation(0, 0, 0), robot.Target); Assert.True(robot.ReachedTarget()); }