예제 #1
0
        public void SetConsoleColors_WhenOnlyForegroundColorsIsDifferentToCurrentColor_OnlyForegroundColorChanged()
        {
            //arrange
            var    fg       = Console.ForegroundColor;
            var    bg       = Console.BackgroundColor;
            string expected = "<fg:Cyan>";

            Console.BackgroundColor = ConsoleColor.DarkBlue;
            Console.ForegroundColor = ConsoleColor.Blue;
            IConsoleWrapper         consoleWrapper          = new ConsoleWrapperMock();
            WordSearchProgramHelper wordSearchProgramHelper = new WordSearchProgramHelper(consoleWrapper, null, null, null);

            //act
            wordSearchProgramHelper.SetConsoleColors(ConsoleColor.Cyan, ConsoleColor.DarkBlue);
            string output = _consoleOuput.ToString();

            //assert
            Assert.Equal(expected, output);

            Console.ForegroundColor = fg;
            Console.BackgroundColor = bg;
        }
예제 #2
0
        public void SetConsoleColors_WhenColorsAreSameAsCurrentColors_ColorsAreNotChanged()
        {
            //arrange
            var    fg       = Console.ForegroundColor;
            var    bg       = Console.BackgroundColor;
            string expected = "";

            Console.BackgroundColor = ConsoleColor.DarkBlue;
            Console.ForegroundColor = ConsoleColor.Blue;
            IConsoleWrapper         consoleWrapper          = new ConsoleWrapperMock();
            WordSearchProgramHelper wordSearchProgramHelper = new WordSearchProgramHelper(consoleWrapper, null, null, null);

            //act
            wordSearchProgramHelper.SetConsoleColors(ConsoleColor.Blue, ConsoleColor.DarkBlue);
            string output = _consoleOuput.ToString();

            //assert
            Assert.Equal(expected, output);

            Console.ForegroundColor = fg;
            Console.BackgroundColor = bg;
        }