Ejemplo n.º 1
0
        public void ExpectSetPrinterNotToThrow()
        {
            var lightPrinter = new PrinterLightMode();
            var darkPrinter  = new PrinterDarkMode();

            Assert.DoesNotThrow(() => lightPrinter.SetPrinter(darkPrinter));
        }
Ejemplo n.º 2
0
        public void ExpectPrinterLightModeToApplayWhiteBackgroundToConsole()
        {
            var lightPrinter = new PrinterLightMode();

            lightPrinter.Apply();

            var resultColor = Console.BackgroundColor;

            Assert.AreEqual(ConsoleColor.Black, resultColor);
        }
Ejemplo n.º 3
0
        public void ExpectPrintLineOfPrinterDecoratorNotToThrow()
        {
            var lightPrinter    = new PrinterLightMode();
            var standartPrinter = new StandardPrinter();

            lightPrinter.SetPrinter(standartPrinter);
            var message = "test message";

            Assert.DoesNotThrow(() => lightPrinter.PrintLine(message));
        }
Ejemplo n.º 4
0
        public void ExpectPrinterLightModeToApplayBlackForegroundColorToConsole()
        {
            var lightPrinter = new PrinterLightMode();

            lightPrinter.Apply();

            var resultColor = Console.ForegroundColor;

            Assert.AreEqual(ConsoleColor.Gray, resultColor);
        }
Ejemplo n.º 5
0
        public void ExpectGetPrintFrameOfPrintDecoratorNotToBeEmptyString()
        {
            var matrix = new MatrixFactory().CreateMatrix(MatrixTypes.BIG);

            var player = new Player();

            var printer         = new PrinterLightMode();
            var standartPrinter = new StandardPrinter();

            printer.SetPrinter(standartPrinter);

            var result = printer.GetPrintFrame(matrix, player);

            Assert.AreNotEqual(result.Length, 0);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Takes the "mode" command and process its implementation.
        /// </summary>
        /// <param name="commandInfo">Command used to switch from dark to light mode, and vise versa.</param>
        public override void Execute(ICommandInfo commandInfo)
        {
            if (commandInfo.Params[0] == "light")
            {
                var printerLightMode = new PrinterLightMode();
                printerLightMode.SetPrinter(this.Printer);
                printerLightMode.Apply();
            }
            else if (commandInfo.Params[0] == "dark")
            {
                var printerDarkMode = new PrinterDarkMode();
                printerDarkMode.SetPrinter(this.Printer);
                printerDarkMode.Apply();
            }

            Navigation.ReturnExitNavigation(this.engine, new SecondMenuOptions());
        }