예제 #1
0
        public void TurnRightShouldThrowExceptionWithNullRobot()
        {
            var    robotAction = new RobotAction(new RoverCreator(new RoverBuilder()));
            IRobot rover       = null;

            robotAction.TurnRight(rover);
        }
예제 #2
0
        public void RoverShouldTurnRight(CardinalPoint InitialPoint, CardinalPoint ExpectedCardinalPoint)
        {
            Mock <IRoverCreator> roverCreator = new Mock <IRoverCreator>();

            roverCreator.Setup(x => x.CreateRover()).Returns(new Robot
            {
                FacingTo = InitialPoint,
                Position = new CoordinatePoint
                {
                    CoordX = 0,
                    CoordY = 0
                }
            });
            var rover       = roverCreator.Object.CreateRover();
            var robotAction = new RobotAction(new RoverCreator(new RoverBuilder()));

            robotAction.TurnRight(rover);
            Assert.AreEqual(rover.FacingTo, ExpectedCardinalPoint);
        }