예제 #1
0
        public void SetColors_Changes_Colors()
        {
            var driver = new FakeDriver();

            driver.Init(() => { });
            Assert.Equal(ConsoleColor.Gray, Console.ForegroundColor);
            Assert.Equal(ConsoleColor.Black, Console.BackgroundColor);

            Console.ForegroundColor = ConsoleColor.Red;
            Assert.Equal(ConsoleColor.Red, Console.ForegroundColor);

            Console.BackgroundColor = ConsoleColor.Green;
            Assert.Equal(ConsoleColor.Green, Console.BackgroundColor);

            Console.ResetColor();
            Assert.Equal(ConsoleColor.Gray, Console.ForegroundColor);
            Assert.Equal(ConsoleColor.Black, Console.BackgroundColor);
            driver.End();
        }
예제 #2
0
        public void SetColors_Changes_Colors()
        {
            var driver = new FakeDriver();

            Application.Init(driver, new FakeMainLoop(() => FakeConsole.ReadKey(true)));
            driver.Init(() => { });
            Assert.Equal(ConsoleColor.Gray, Console.ForegroundColor);
            Assert.Equal(ConsoleColor.Black, Console.BackgroundColor);

            Console.ForegroundColor = ConsoleColor.Red;
            Assert.Equal(ConsoleColor.Red, Console.ForegroundColor);

            Console.BackgroundColor = ConsoleColor.Green;
            Assert.Equal(ConsoleColor.Green, Console.BackgroundColor);

            Console.ResetColor();
            Assert.Equal(ConsoleColor.Gray, Console.ForegroundColor);
            Assert.Equal(ConsoleColor.Black, Console.BackgroundColor);
            driver.End();
        }
예제 #3
0
        public void SetColors_Changes_Colors()
        {
            var driver = new FakeDriver();

            Application.Init(driver, new FakeMainLoop(() => FakeConsole.ReadKey(true)));
            driver.Init(() => { });
            Assert.Equal(ConsoleColor.Gray, Console.ForegroundColor);
            Assert.Equal(ConsoleColor.Black, Console.BackgroundColor);

            Console.ForegroundColor = ConsoleColor.Red;
            Assert.Equal(ConsoleColor.Red, Console.ForegroundColor);

            Console.BackgroundColor = ConsoleColor.Green;
            Assert.Equal(ConsoleColor.Green, Console.BackgroundColor);

            Console.ResetColor();
            Assert.Equal(ConsoleColor.Gray, Console.ForegroundColor);
            Assert.Equal(ConsoleColor.Black, Console.BackgroundColor);
            driver.End();

            // Shutdown must be called to safely clean up Application if Init has been called
            Application.Shutdown();
        }