Ejemplo n.º 1
0
        public void XenexPrintExpectedMessageTest()
        {
            var messages = new List <string>();

            for (int i = 1; i <= TestLoopCount; i++)
            {
                StringBuilder messageBuilder = new StringBuilder();
                messageBuilder.Append(i.ToString());

                foreach (KeyValuePair <int, string> messageCase in messageCases)
                {
                    if (i % messageCase.Key == 0)
                    {
                        messageBuilder.Append(" " + messageCase.Value);
                    }
                }

                messages.Add(messageBuilder.ToString());
            }

            int index = 0;

            foreach (string message in XenexPrint.GenerateMessages(TestLoopCount, messageCases))
            {
                Assert.AreEqual(message, messages[index]);
                index++;
            }
        }
Ejemplo n.º 2
0
        public void XenexPrintLoopCountTest()
        {
            int loopCount = 0;

            foreach (string message in XenexPrint.GenerateMessages(TestLoopCount, messageCases))
            {
                loopCount++;
            }

            Assert.AreEqual(TestLoopCount, loopCount);
        }
Ejemplo n.º 3
0
        public void XenexPrint15MessageTest()
        {
            var testMessage = "";

            foreach (string message in XenexPrint.GenerateMessages(TestLoopCount, messageCases))
            {
                testMessage = message;
            }

            Assert.AreEqual(testMessage, "15 fizz buzz");
        }