コード例 #1
0
        public void TestLogic(Tuple <int, int> plateauSize, List <RoverTestData> roverTestData)
        {
            SimulationManager simMan = new SimulationManager(plateauSize.Item1, plateauSize.Item2);

            foreach (RoverTestData td in roverTestData)
            {
                int roverId = simMan.LandRover(new RoverNasa("Pathfinder")
                {
                    Position          = td.LandingLocation,
                    CardinalDirection = td.LandingOrientation,
                    Speed             = 1
                });

                simMan.ProcessRoverCommands(roverId, td.Instructions);
                IRover rover = simMan.GetRover(roverId);
                TestContext.WriteLine($"Rover id: {rover.Id} Rover XY: {rover.Position.X} {rover.Position.Y} Rover Direction: {rover.CardinalDirection.ToString()}");
                Assert.IsTrue(
                    rover.Position.X == td.ExpectedEndLocation.X &&
                    rover.Position.Y == td.ExpectedEndLocation.Y &&
                    rover.CardinalDirection == td.ExpectedEndOrientation
                    );
            }
        }