コード例 #1
0
ファイル: GridTests.cs プロジェクト: ImpulseChimp/CodingKatas
 public void GridToStringWorks()
 {
     grid.PlaceObstacleAt(4, 4);
     grid.PlaceObstacleAt(0, 0);
     marsRover = new MarsRover(grid, 0, 4, DirectionConstants.East);
     marsRover.RunRoverWithCommands("f");
     var stringGrid = marsRover.PrintMap();
     System.Diagnostics.Debug.WriteLine(stringGrid);
     Assert.AreEqual(".R__X\n_____\n_____\n_____\nX____\n", stringGrid);
 }
コード例 #2
0
ファイル: GridTests.cs プロジェクト: ImpulseChimp/CodingKatas
        public void RoverStopsAtObstacleInMultiStepPath()
        {
            grid.PlaceObstacleAt(4, 4);
            marsRover = new MarsRover(grid, 0, 0, DirectionConstants.East);
            marsRover.RunRoverWithCommands("fflffrflffrf");
            Assert.IsTrue(marsRover.AtObstacle);

            var stringGrid = marsRover.PrintMap();
            System.Diagnostics.Debug.WriteLine(stringGrid);
        }
コード例 #3
0
ファイル: GridTests.cs プロジェクト: ImpulseChimp/CodingKatas
        public void RoverStopsAtObstacleInPath(Char initialDirection)
        {
            grid.PlaceObstacleAt(1, 0);
            grid.PlaceObstacleAt(2, 1);
            grid.PlaceObstacleAt(0, 1);
            grid.PlaceObstacleAt(1, 2);
            marsRover = new MarsRover(grid, 1, 1, initialDirection);
            marsRover.RunRoverWithCommands("f");
            Assert.IsTrue(marsRover.AtObstacle);

            var stringGrid = marsRover.PrintMap();
            System.Diagnostics.Debug.WriteLine(stringGrid);
        }
コード例 #4
0
ファイル: GridTests.cs プロジェクト: ImpulseChimp/CodingKatas
        public void VerifyRoverWrapsFromBottomOfGridToTheTop()
        {
            marsRover = new MarsRover(grid, 2, 0, DirectionConstants.South);
            marsRover.RunRoverWithCommands("f");
            Assert.AreEqual(2, marsRover.XCoordinate);
            Assert.AreEqual(4, marsRover.YCoordinate);

            var stringGrid = marsRover.PrintMap();
            System.Diagnostics.Debug.WriteLine(stringGrid);
        }
コード例 #5
0
ファイル: GridTests.cs プロジェクト: ImpulseChimp/CodingKatas
        public void VerifyRoverWrapsFromRightOfGridToLeft()
        {
            marsRover = new MarsRover(grid, 4, 0, DirectionConstants.East);
            marsRover.RunRoverWithCommands("f");
            Assert.AreEqual(0, marsRover.XCoordinate);
            Assert.AreEqual(0, marsRover.YCoordinate);
            marsRover.XCoordinate = 6;

            var stringGrid = marsRover.PrintMap();
            System.Diagnostics.Debug.WriteLine(stringGrid);
        }