Beispiel #1
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);
        }