Exemplo n.º 1
0
        public void Init_Inits()
        {
            var driver = new FakeDriver();

            driver.Init(() => { });

            Assert.Equal(80, Console.BufferWidth);
            Assert.Equal(25, Console.BufferHeight);

            // MockDriver is always 80x25
            Assert.Equal(Console.BufferWidth, driver.Cols);
            Assert.Equal(Console.BufferHeight, driver.Rows);
            driver.End();
        }
Exemplo n.º 2
0
        public void Init_Inits()
        {
            var driver = new FakeDriver();

            Application.Init(driver, new FakeMainLoop(() => FakeConsole.ReadKey(true)));
            driver.Init(() => { });

            Assert.Equal(80, Console.BufferWidth);
            Assert.Equal(25, Console.BufferHeight);

            // MockDriver is always 80x25
            Assert.Equal(Console.BufferWidth, driver.Cols);
            Assert.Equal(Console.BufferHeight, driver.Rows);
            driver.End();
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
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();
        }
Exemplo n.º 5
0
        public void End_Cleans_Up()
        {
            var driver = new FakeDriver();

            driver.Init(() => { });

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

            FakeConsole.BackgroundColor = ConsoleColor.Green;
            Assert.Equal(ConsoleColor.Green, Console.BackgroundColor);
            driver.Move(2, 3);
            Assert.Equal(2, Console.CursorLeft);
            Assert.Equal(3, Console.CursorTop);

            driver.End();
            Assert.Equal(0, Console.CursorLeft);
            Assert.Equal(0, Console.CursorTop);
            Assert.Equal(ConsoleColor.Gray, Console.ForegroundColor);
            Assert.Equal(ConsoleColor.Black, Console.BackgroundColor);
        }
Exemplo n.º 6
0
        public void End_Cleans_Up()
        {
            var driver = new FakeDriver();

            Application.Init(driver, new NetMainLoop(() => FakeConsole.ReadKey(true)));
            driver.Init(() => { });

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

            FakeConsole.BackgroundColor = ConsoleColor.Green;
            Assert.Equal(ConsoleColor.Green, Console.BackgroundColor);
            driver.Move(2, 3);
            Assert.Equal(2, Console.CursorLeft);
            Assert.Equal(3, Console.CursorTop);

            driver.End();
            Assert.Equal(0, Console.CursorLeft);
            Assert.Equal(0, Console.CursorTop);
            Assert.Equal(ConsoleColor.Gray, Console.ForegroundColor);
            Assert.Equal(ConsoleColor.Black, Console.BackgroundColor);
        }