Exemple #1
0
 static void ProcessStart(Mission mission)
 {
     try
     {
         MarsRoverService service = new MarsRoverService();
         service.MissionStart(mission);
         Console.WriteLine(" >>>> Process End <<<< ");
         Console.ReadLine();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message, Console.BackgroundColor = ConsoleColor.DarkRed);
         ProcessStart(mission);
     }
 }
            public void MissionStart_Valid()
            {
                var plateu = new Plateau()
                {
                    X         = 5,
                    Y         = 5,
                    IsSuccess = true
                };

                var roverCount = new RoverCount()
                {
                    Count     = 2,
                    IsSuccess = true
                };

                var roverOne = new Rover()
                {
                    Info = new RoverInfo()
                    {
                        X         = 1,
                        Y         = 2,
                        Direction = Compass.N,
                        IsSuccess = true
                    },
                    Moves = new RoverMove()
                    {
                        Moves     = "LMLMLMLMM",
                        IsSuccess = true
                    },
                    IsSuccess = true
                };

                var roverTwo = new Rover()
                {
                    Info = new RoverInfo()
                    {
                        X         = 3,
                        Y         = 3,
                        Direction = Compass.E,
                        IsSuccess = true
                    },
                    Moves = new RoverMove()
                    {
                        Moves     = "MMRMMRMRRM",
                        IsSuccess = true
                    },
                    IsSuccess = true
                };

                var roverList = new List <Rover>
                {
                    roverOne,
                    roverTwo
                };

                var mission = new Mission
                {
                    Plateau    = plateu,
                    RoverCount = roverCount,
                    Rovers     = roverList,
                    IsSuccess  = true
                };

                var result = service.MissionStart(mission);

                Assert.IsTrue(!result.Any(x => !x.IsSuccess));
            }