示例#1
0
        static void Main(string[] args)
        {
            Properties.Resources.WelcomeMessage.Display(ConsoleColor.White);

            var timer   = new InstantTimer();
            var provier = new TextReaderConfigurationProvider();

            Plateau plateau = new Plateau();

            plateau.Rovers.CollectionChanged += MonitorRoverCollection;

            do
            {
                ConsoleExntesion.SetConsoleColor(ConsoleColor.Cyan);
                provier.InitializeScenario(timer, plateau);
                ConsoleExntesion.SetConsoleColor();

                plateau.Display();

                "Simulation Start".Display(ConsoleColor.White);

                timer.Start();

                "Simulation Completed".Display(ConsoleColor.White);

                plateau.Display();
            }while ("Try once again? ".Ask(ConsoleColor.White, Answers.RQ) == Answers.Retry);

            #region Pause "Press any key to Exit..."
            Console.WriteLine("Press any key to Exit...");
            Console.ReadKey();
            #endregion
        }
示例#2
0
        public void OriginalTestCase()
        {
            var timer = new InstantTimer();

            var provider = new HardCodeConfigurationProvider();

            var plateau = provider.InitializeScenario(timer);

            Assert.Equal(new Size(5, 5), plateau.Size);

            var expected = new string[]
            {
                "1 2 N",
                "3 3 E",
            };

            var actual = from fo in plateau.Rovers
                         select fo.ToString();

            Assert.Equal(expected, actual.ToArray());

            timer.Start();

            expected = new string[]
            {
                "1 3 N",
                "5 1 E",
            };

            actual = from fo in plateau.Rovers
                     select fo.ToString();

            Assert.Equal(expected, actual.ToArray());
        }