Esempio n. 1
0
        public void ParseOrientation_WhenPassedValidDirection_ShouldParse()
        {
            var coord    = "1 4 N";
            var expected = Orientation.North;
            var actual   = RoverController.ParseOrientation(coord);

            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        public Rover(string position, Plateau plateau)
        {
            Coordinate = RoverController.ParseCoordinate(position);
            if (Coordinate.X > plateau.TopRight.X ||
                Coordinate.Y > plateau.TopRight.Y ||
                Coordinate.Y < 0 ||
                Coordinate.X < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(position), "Rover out of range of the plateau graph.");
            }

            Orientation = RoverController.ParseOrientation(position);
        }
Esempio n. 3
0
        public void ParseOrientation_WhenPassedInvalidDirection_ShouldThrow()
        {
            var coord = "1 2 B";

            Assert.ThrowsException <ArgumentException>(() => RoverController.ParseOrientation(coord));
        }
Esempio n. 4
0
 public void ParseOrientation_WhenPassedEmptyString_ShouldThrow()
 {
     Assert.ThrowsException <ArgumentException>(() => RoverController.ParseOrientation(""));
 }