Ejemplo n.º 1
0
        public void TestRenderMessageToProceedAllPassedText()
        {
            var mockedWriter = new Mock <HelperWriter>();

            Console.SetOut(mockedWriter.Object);

            List <string> messageToProcess = new List <string>()
            {
                GameMassages.PlayAgainMessage,
                GameMassages.PressBackMessage,
                GameMassages.WelcomeMessage,
                GameMassages.WrongInputAndContinueMessage,
                GameMassages.WrongInputMessage,
                GameMassages.HowToPlayMessage,
                GameMassages.GoodByeMessage
            };

            ConsoleRenderer renderer = new ConsoleRenderer();

            messageToProcess.ForEach(msg => renderer.PrintMessage(msg));

            mockedWriter.Verify(w => w.WriteLine(It.Is <string>(str => messageToProcess.Contains(str))), Times.Exactly(messageToProcess.Count));
        }