Exemplo n.º 1
0
        public void UseCase()
        {
            var appender = new ConsoleAppender();

            _wrapper = new Mock <IConsoleWrapper>();
            _wrapper.Setup(x => x.WriteLine(It.IsAny <string>())).Callback <string>(x => _lastLine = x);

            appender.SetFirstField(_wrapper.Object);
            appender.Append(new LogEvent(0, LogLevel.Info, "A topic", "Some Info", DateTime.Now, 0,
                                         Thread.CurrentThread.ManagedThreadId.ToString(), 1));
            var end = " - [Info] A topic: Some Info [" + Thread.CurrentThread.ManagedThreadId + "]";

            Check.That(_lastLine.EndsWith(end))
            .IsTrue(_lastLine + " should end with " + end);
        }