public void ExplicitCloseWins() { IDefaultActivityLogger l = DefaultActivityLogger.Create(); // Binds the TestHelper.Logger logger to this one. l.Output.RegisterMuxClient(TestHelper.Logger.Output.ExternalInput); var log = new StringImpl(); l.Register(log); // No explicit close conclusion: Success! using (l.OpenGroup(LogLevel.Trace, () => "Success!", "First")) { l.Error("Pouf"); } Assert.That(log.Writer.ToString(), Is.StringContaining("Pouf")); Assert.That(log.Writer.ToString(), Is.Not.StringContaining("Failed!"), "Default conclusion wins."); Assert.That(log.Writer.ToString(), Is.StringContaining("Success!"), "Default conclusion."); log.Writer.GetStringBuilder().Clear(); Assert.That(log.Writer.ToString(), Is.Empty); // Explicit conclusion: Failed! using (l.OpenGroup(LogLevel.Trace, () => "Success!", "First")) { l.Error("Pouf"); l.CloseGroup("Failed!"); } Console.WriteLine(log.Writer.ToString()); Assert.That(log.Writer.ToString(), Is.StringContaining("Pouf")); Assert.That(log.Writer.ToString(), Is.StringContaining("Failed!"), "Explicit conclusion wins."); Assert.That(log.Writer.ToString(), Is.Not.StringContaining("Success!"), "Explicit conclusion wins."); }
public void MultipleClose() { IDefaultActivityLogger logger = DefaultActivityLogger.Create(); // Binds the TestHelper.Logger logger to this one. logger.Output.RegisterMuxClient(TestHelper.Logger.Output.ExternalInput); var log1 = new StringImpl(); logger.Register(log1); Assert.That(logger.RegisteredSinks.Count, Is.EqualTo(1)); using (logger.OpenGroup(LogLevel.Trace, () => "End First", "First")) { logger.CloseGroup("Pouf"); using (logger.OpenGroup(LogLevel.Warn, "A group at level 0!")) { logger.CloseGroup("Close it."); logger.CloseGroup("Close it again."); } } Assert.That(log1.Writer.ToString(), Is.Not.StringContaining("End First"), "Close forgets other closes..."); Assert.That(log1.Writer.ToString(), Is.Not.StringContaining("Close it again"), "Close forgets other closes..."); }
public void CatchTests() { IDefaultActivityLogger d = DefaultActivityLogger.Create(); Assert.Throws <ArgumentNullException>(() => d.Catch(null)); d.Error("Pouf"); using (d.Catch(e => Assert.That(String.Join(",", e.Select(t => t.Text)) == "One,Two"))) { d.Error("One"); d.Warn("Warn"); d.Fatal("Two"); } d.Error("Out..."); using (d.Catch(e => e.Single(t => t.Text == "Two"), LogLevelFilter.Fatal)) { d.Error("One"); d.Warn("Warn"); d.Fatal("Two"); } using (d.Catch(e => Assert.Fail("No Error occured."))) { d.Trace("One"); d.Warn("Warn"); } using (d.Catch(e => Assert.Fail("No Fatal occured."), LogLevelFilter.Fatal)) { d.Error("One"); d.Warn("Warn"); } }
public void FilterLevel() { IDefaultActivityLogger l = DefaultActivityLogger.Create(); // Binds the TestHelper.Logger logger to this one. l.Output.RegisterMuxClient(TestHelper.Logger.Output.ExternalInput); var log = new StringImpl(); l.Register(log); using (l.Filter(LogLevelFilter.Error)) { l.Trace("NO SHOW"); l.Info("NO SHOW"); l.Warn("NO SHOW"); l.Error("Error n°1"); using (l.Filter(LogLevelFilter.Warn)) { l.Trace("NO SHOW"); l.Info("NO SHOW"); l.Warn("Warn n°1"); l.Error("Error n°2"); using (l.OpenGroup(LogLevel.Info, "GroupInfo")) { Assert.That(l.Filter, Is.EqualTo(LogLevelFilter.Warn), "Groups does not change the current filter level."); l.Trace("NO SHOW"); l.Info("NO SHOW"); l.Warn("Warn n°2"); l.Error("Error n°3"); // Changing the level inside a Group. l.Filter = LogLevelFilter.Fatal; l.Error("NO SHOW"); l.Fatal("Fatal n°1"); } Assert.That(l.Filter, Is.EqualTo(LogLevelFilter.Warn), "But Groups restores the original filter level when closed."); l.Trace("NO SHOW"); l.Info("NO SHOW"); l.Warn("Warn n°3"); l.Error("Error n°4"); l.Fatal("Fatal n°2"); } l.Trace("NO SHOW"); l.Info("NO SHOW"); l.Warn("NO SHOW"); l.Error("Error n°5"); } Assert.That(log.Writer.ToString(), Is.Not.StringContaining("NO SHOW")); Assert.That(log.Writer.ToString(), Is.StringContaining("Error n°1") .And.StringContaining("Error n°2") .And.StringContaining("Error n°3") .And.StringContaining("Error n°4") .And.StringContaining("Error n°5")); Assert.That(log.Writer.ToString(), Is.StringContaining("Warn n°1") .And.StringContaining("Warn n°2") .And.StringContaining("Warn n°3")); Assert.That(log.Writer.ToString(), Is.StringContaining("Fatal n°1") .And.StringContaining("Fatal n°2")); }
public void DefaultActivityLoggerDefaults() { IDefaultActivityLogger l = DefaultActivityLogger.Create(); Assert.Throws <InvalidOperationException>(() => l.Output.UnregisterClient(l.Tap)); Assert.Throws <InvalidOperationException>(() => l.Output.UnregisterMuxClient(l.Tap)); Assert.Throws <InvalidOperationException>(() => l.Output.UnregisterClient(l.PathCatcher)); Assert.Throws <InvalidOperationException>(() => l.Output.UnregisterMuxClient(l.PathCatcher)); Assert.Throws <InvalidOperationException>(() => l.Output.UnregisterClient(l.ErrorCounter)); Assert.Throws <InvalidOperationException>(() => l.Output.UnregisterMuxClient(l.ErrorCounter)); }
public void DefaultImpl() { IDefaultActivityLogger logger = DefaultActivityLogger.Create(); // Binds the TestHelper.Logger logger to this one. logger.Output.RegisterMuxClient(TestHelper.Logger.Output.ExternalInput); logger.Register(new StringImpl()).Register(new XmlImpl(new StringWriter())); Assert.That(logger.RegisteredSinks.Count, Is.EqualTo(2)); using (logger.OpenGroup(LogLevel.Trace, () => "EndMainGroup", "MainGroup")) { logger.Trace("First"); logger.Trace("Second"); logger.Trace("Third"); logger.Info("First"); using (logger.OpenGroup(LogLevel.Info, () => "EndInfoGroup", "InfoGroup")) { logger.Info("Second"); logger.Trace("Fourth"); using (logger.OpenGroup(LogLevel.Warn, () => "EndWarnGroup", "WarnGroup {0} - Now = {1}", 4, DateTime.UtcNow)) { logger.Info("Warn!"); } } } Console.WriteLine(logger.RegisteredSinks.OfType <StringImpl>().Single().Writer); Console.WriteLine(logger.RegisteredSinks.OfType <XmlImpl>().Single().InnerWriter); XPathDocument d = new XPathDocument(new StringReader(logger.RegisteredSinks.OfType <XmlImpl>().Single().InnerWriter.ToString())); Assert.That(d.CreateNavigator().SelectDescendants("Info", String.Empty, false), Is.Not.Empty.And.Count.EqualTo(3)); Assert.That(d.CreateNavigator().SelectDescendants("Trace", String.Empty, false), Is.Not.Empty.And.Count.EqualTo(2)); }
public void CloseMismatch() { IDefaultActivityLogger l = DefaultActivityLogger.Create(); var log = new StringImpl(); l.Register(log); { IDisposable g0 = l.OpenGroup(LogLevel.Trace, "First"); IDisposable g1 = l.OpenGroup(LogLevel.Trace, "Second"); IDisposable g2 = l.OpenGroup(LogLevel.Trace, "Third"); g1.Dispose(); l.Trace("Inside First"); g0.Dispose(); l.Trace("At root"); var end = "Trace: Inside First" + Environment.NewLine + "-" + Environment.NewLine + "Trace: At root"; Assert.That(log.Writer.ToString(), Is.StringEnding(end)); } { // g2 is closed after g1. IDisposable g0 = l.OpenGroup(LogLevel.Trace, "First"); IDisposable g1 = l.OpenGroup(LogLevel.Trace, "Second"); IDisposable g2 = l.OpenGroup(LogLevel.Trace, "Third"); log.Writer.GetStringBuilder().Clear(); g1.Dispose(); // g2 has already been disposed by g1. // Nothing changed. g2.Dispose(); l.Trace("Inside First"); g0.Dispose(); l.Trace("At root"); var end = "Trace: Inside First" + Environment.NewLine + "-" + Environment.NewLine + "Trace: At root"; Assert.That(log.Writer.ToString(), Is.StringEnding(end)); } }
public void SimpleCollectorTest() { IDefaultActivityLogger d = DefaultActivityLogger.Create(); var c = new ActivityLoggerSimpleCollector(); d.Output.RegisterClient(c); d.Warn("1"); d.Error("2"); d.Fatal("3"); d.Trace("4"); d.Info("5"); d.Warn("6"); Assert.That(String.Join(",", c.Entries.Select(e => e.Text)), Is.EqualTo("2,3")); c.LevelFilter = LogLevelFilter.Fatal; Assert.That(String.Join(",", c.Entries.Select(e => e.Text)), Is.EqualTo("3")); c.LevelFilter = LogLevelFilter.Off; Assert.That(String.Join(",", c.Entries.Select(e => e.Text)), Is.EqualTo("")); c.LevelFilter = LogLevelFilter.Warn; using (d.OpenGroup(LogLevel.Warn, "1")) { d.Error("2"); using (d.OpenGroup(LogLevel.Fatal, "3")) { d.Trace("4"); d.Info("5"); } } d.Warn("6"); Assert.That(String.Join(",", c.Entries.Select(e => e.Text)), Is.EqualTo("1,2,3,6")); c.LevelFilter = LogLevelFilter.Fatal; Assert.That(String.Join(",", c.Entries.Select(e => e.Text)), Is.EqualTo("3")); }
static TestHelper() { _console = new ActivityLoggerConsoleSink(); _logger = DefaultActivityLogger.Create().Register( _console ); }
static TestHelper() { _console = new ActivityLoggerConsoleSink(); _logger = DefaultActivityLogger.Create().Register(_console); }
/// <summary> /// Start the logger and use the string implementation /// </summary> private Logger() { _logger = new DefaultActivityLogger(); _logger.Tap.Register( new ListImpl() ); }
public void Overloads() { Exception ex = new Exception("EXCEPTION"); string fmt0 = "fmt", fmt1 = "fmt{0}", fmt2 = "fmt{0}{1}", fmt3 = "fmt{0}{1}{2}", fmt4 = "fmt{0}{1}{2}{3}", fmt5 = "fmt{0}{1}{2}{3}{4}", fmt6 = "fmt{0}{1}{2}{3}{4}{5}"; string p1 = "p1", p2 = "p2", p3 = "p3", p4 = "p4", p5 = "p5", p6 = "p6"; IDefaultActivityLogger d = DefaultActivityLogger.Create(); var collector = new ActivityLoggerSimpleCollector() { LevelFilter = LogLevelFilter.Trace, Capacity = 1 }; d.Output.RegisterClient(collector); d.Trace(fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); d.Trace(fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); d.Trace(fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); d.Trace(fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); d.Trace(fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); d.Trace(fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); d.Trace(fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); d.Info(fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); d.Info(fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); d.Info(fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); d.Info(fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); d.Info(fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); d.Info(fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); d.Info(fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); d.Warn(fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); d.Warn(fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); d.Warn(fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); d.Warn(fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); d.Warn(fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); d.Warn(fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); d.Warn(fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); d.Error(fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); d.Error(fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); d.Error(fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); d.Error(fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); d.Error(fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); d.Error(fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); d.Error(fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); d.Fatal(fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); d.Fatal(fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); d.Fatal(fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); d.Fatal(fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); d.Fatal(fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); d.Fatal(fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); d.Fatal(fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); d.OpenGroup(LogLevel.Trace, fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); d.OpenGroup(LogLevel.Trace, fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); d.OpenGroup(LogLevel.Trace, fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); d.OpenGroup(LogLevel.Trace, fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); d.OpenGroup(LogLevel.Trace, fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); d.OpenGroup(LogLevel.Trace, fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); d.OpenGroup(LogLevel.Trace, fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); d.Trace(ex); Assert.That(collector.Entries.Last().Text, Is.EqualTo("EXCEPTION")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Trace(ex, fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Trace(ex, fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Trace(ex, fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Trace(ex, fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Trace(ex, fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Trace(ex, fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Trace(ex, fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Info(ex); Assert.That(collector.Entries.Last().Text, Is.EqualTo("EXCEPTION")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Info(ex, fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Info(ex, fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Info(ex, fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Info(ex, fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Info(ex, fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Info(ex, fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Info(ex, fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Warn(ex); Assert.That(collector.Entries.Last().Text, Is.EqualTo("EXCEPTION")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Warn(ex, fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Warn(ex, fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Warn(ex, fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Warn(ex, fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Warn(ex, fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Warn(ex, fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Warn(ex, fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Error(ex); Assert.That(collector.Entries.Last().Text, Is.EqualTo("EXCEPTION")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Error(ex, fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Error(ex, fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Error(ex, fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Error(ex, fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Error(ex, fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Error(ex, fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Error(ex, fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Fatal(ex); Assert.That(collector.Entries.Last().Text, Is.EqualTo("EXCEPTION")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Fatal(ex, fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Fatal(ex, fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Fatal(ex, fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Fatal(ex, fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Fatal(ex, fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Fatal(ex, fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.Fatal(ex, fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.OpenGroup(LogLevel.Trace, ex); Assert.That(collector.Entries.Last().Text, Is.EqualTo("EXCEPTION")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.OpenGroup(LogLevel.Trace, ex, fmt0); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmt")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.OpenGroup(LogLevel.Trace, ex, fmt1, p1); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.OpenGroup(LogLevel.Trace, ex, fmt2, p1, p2); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.OpenGroup(LogLevel.Trace, ex, fmt3, p1, p2, p3); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.OpenGroup(LogLevel.Trace, ex, fmt4, p1, p2, p3, p4); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.OpenGroup(LogLevel.Trace, ex, fmt5, p1, p2, p3, p4, p5); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); d.OpenGroup(LogLevel.Trace, ex, fmt6, p1, p2, p3, p4, p5, p6); Assert.That(collector.Entries.Last().Text, Is.EqualTo("fmtp1p2p3p4p5p6")); Assert.That(collector.Entries.Last().Exception, Is.SameAs(ex)); }