public void CanMoveAllAround_WhenCommandNotSupported_ShouldThrowException()
        {
            // arrange
            var rover = new PlutoRover(0, 0, CardinalDirection.North);

            //act
            rover.MakeCommand("MickeyMouse");
        }
Пример #2
0
        public void CanRotateFullCounterClockWise_WhenDirectionIsNorth_OrientationShouldBeNorth()
        {
            // arrange
            var rover = new PlutoRover(0, 0, CardinalDirection.North);

            //act
            rover.MakeCommand("LLLL");
            //assert
            Assert.AreEqual(CardinalDirection.North, rover.RoverDirection);
        }
Пример #3
0
        public void CanRotateLeft_WhenDirectionIsNorth_OrientationShouldBeEast()
        {
            // arrange
            var rover = new PlutoRover(0, 0, CardinalDirection.North);

            //act
            rover.MakeCommand("L");
            //assert
            Assert.AreEqual(CardinalDirection.West, rover.RoverDirection);
        }
Пример #4
0
        public void CanMoveBackwars_WhenAt00FacingEast_CoordinateXEquals99()
        {
            // arrange
            var rover = new PlutoRover(0, 0, CardinalDirection.East);

            //act
            rover.MakeCommand("B");
            //assert
            Assert.AreEqual(Convert.ToUInt32(99), rover.CoordinateX);
        }
Пример #5
0
        public void CanMoveForward_WhenAtEdgeFacingNorth_CoordinateYEquals0()
        {
            // arrange
            var rover = new PlutoRover(PlutoRover.SURFACE_SIZE - 1, PlutoRover.SURFACE_SIZE - 1, CardinalDirection.North);

            //act
            rover.MakeCommand("F");
            //assert
            Assert.AreEqual(Convert.ToUInt32(0), rover.CoordinateY);
        }
Пример #6
0
        public void CanMoveBackWardOneField()
        {
            // arrange
            var rover = new PlutoRover(0, 1, CardinalDirection.North);

            //act
            rover.MakeCommand("B");
            //assert
            Assert.AreEqual("00North", rover.GetRoverCoordinatesAndDirection());
        }
        public void CanMoveAndRotateAllAround()
        {
            // arrange
            var rover = new PlutoRover(0, 0, CardinalDirection.North);

            //act
            rover.MakeCommand("FFRFF");
            //assert
            Assert.AreEqual("22East", rover.GetRoverCoordinatesAndDirection());
        }
        public void TryMoveTwoField_WhenObstacleOnSecondField_CanMoveOneFieldAndReportObstacle()
        {
            // arrange
            var rover = new PlutoRover(0, 0, CardinalDirection.North);

            rover.Surface[0, 2] = 1;
            //act
            rover.MakeCommand("FF");
            //assert
            Assert.AreEqual("01North", rover.GetRoverCoordinatesAndDirection());
            Assert.IsTrue(rover.ObstacleDetected);
        }
        public void TryMoveOneField_WhenObstacleOnThatField_ShouldReportIt()
        {
            // arrange
            var rover = new PlutoRover(0, 0, CardinalDirection.North);

            rover.Surface[0, 1] = 1;
            //act
            rover.MakeCommand("F");
            //assert
            Assert.AreEqual("00North", rover.GetRoverCoordinatesAndDirection());
            Assert.IsTrue(rover.ObstacleDetected);
        }