예제 #1
0
        public void WriteLine_should_append_to_log_with_formatting_and_newline()
        {
            // given
            TestFileRunnerLogger logger = CreateLogger();
            string expectedText         = ExpectedMessage("a message item1 item2" + Environment.NewLine);

            // when
            logger.WriteLine("a message {0} {1}", "item1", "item2");

            // then
            string actualText = logger.LogStringBuilder.ToString();

            Assert.That(actualText, Is.EqualTo(expectedText));
        }
예제 #2
0
        public void WriteLine_should_append_exception_type_and_message()
        {
            // given
            TestFileRunnerLogger logger = CreateLogger();
            string expectedText         = ExpectedMessage(string.Format("message{0}System.Exception: exception message{0}", Environment.NewLine));

            // when
            logger.WriteLine(new Exception("exception message"), "message");

            // then
            string actualText = logger.LogStringBuilder.ToString();

            Assert.That(actualText, Is.EqualTo(expectedText));
        }