예제 #1
0
파일: App.cs 프로젝트: RecepCifci/MarsRover
        public void Initialize()
        {
            CheckPlateauValues(_plateauManager);

            var addAnotherRover = false;

            do
            {
                CheckRoverPositionValues(_roverManager);
                string roverCommandsInput = CheckRoverCommandValues(_roverManager);
                _roverCommandsManager.CommandList = roverCommandsInput;

                _plateauManager.RoverManagerList.Add(_roverManager);

                Console.WriteLine(Messages.Information.AddAnotherRover);

                var addAnotherRoverInput = Console.ReadLine();

                addAnotherRover = addAnotherRoverInput.ToUpper() == "Y" ? true : false;
            } while (addAnotherRover);

            _plateauManager.Process();
            _plateauManager.Print();
            Console.ReadLine();
        }
예제 #2
0
        public void TestMethod(string testname, IPlateauManager plateauManager, string[] position)
        {
            plateauManager.Process();
            string[] positionList = new string[plateauManager.RoverManagerList.Count];

            for (int i = 0; i < plateauManager.RoverManagerList.Count; i++)
            {
                positionList[i] = $"{plateauManager.RoverManagerList[i].Rover.Position.CoordinateX} {plateauManager.RoverManagerList[i].Rover.Position.CoordinateY} {plateauManager.RoverManagerList[i].Rover.Position.Direction.ToString().Substring(0, 1)}";
            }

            Assert.Equal(positionList, position);
        }