public void FatalMessageWritesAsTraceError() { string message = "message"; string logname = "logger"; var mockTrace = new Mock<ITrace>(); mockTrace.Setup(x => x.TraceError("[{0}] {1} {2}", "FATAL", logname, message)).Verifiable(); ITrace trace = mockTrace.Object; ILog tested = new TraceLogger(logname, trace); tested.Fatal(message); mockTrace.Verify(); }
public void DebugMessageWritesAsTraceInformation() { string message = "message"; string logname = "logger"; var mockTrace = new Mock<ITrace>(); mockTrace.Setup(x => x.TraceInformation("[{0}] {1} {2}", "DEBUG", logname, message)).Verifiable(); ITrace trace = mockTrace.Object; ILog tested = new TraceLogger(logname, trace); tested.Debug(message); mockTrace.Verify(); }
public void FormattedDebugMessageWritesAsTraceInformation() { string format = "message {0}"; string arg = "theArg"; string logname = "logger"; var mockTrace = new Mock<ITrace>(); mockTrace.Setup(x => x.TraceInformation("[{0}] {1} {2}", "DEBUG", logname, string.Format(format, arg))).Verifiable(); ITrace trace = mockTrace.Object; ILog tested = new TraceLogger(logname, trace); tested.Debug(format, arg); mockTrace.Verify(); }
public void DefaultTraceIsTraceWrapper() { TraceLogger tested = new TraceLogger("name"); Assert.IsInstanceOfType(tested.Trace, typeof(TraceWrapper)); }
public void ReturnsTheNameItWasCreatedWith() { string expected = "loggername"; TraceLogger tested = new TraceLogger(expected); string actual = tested.Name; Assert.AreEqual(expected, actual); }