public void SetLogAction() { bool isLoggerActionCalled = false; HighPerfLogger.SetLogAction(str => { isLoggerActionCalled = true; }); Assert.That(isLoggerActionCalled, Is.False); HighPerfLogger.Log("Hello World!"); Assert.That(isLoggerActionCalled, Is.True); Assert.Throws <ArgumentNullException>(() => HighPerfLogger.SetLogAction(null !)); }
public void Log() { var theBuilder = new StringBuilder(); HighPerfLogger.SetLogAction(s => theBuilder.Append(s)); HighPerfLogger.Log("This "); HighPerfLogger.Log("is "); HighPerfLogger.Log("a "); HighPerfLogger.Log("test."); Assert.That(theBuilder.ToString(), Is.EqualTo("This is a test.")); }