public void WhenReplacingTracer_ThenTracersInvokeIt() { var tracer = new Mock <ITracer> { DefaultValue = DefaultValue.Mock }; using (TracerExtensibility.SetTracer(tracer.Object)) { global::System.Diagnostics.Tracer.GetSourceFor <IComparable>(); tracer.Verify(x => x.GetSourceEntryFor("*")); tracer.Verify(x => x.GetSourceEntryFor("System")); tracer.Verify(x => x.GetSourceEntryFor("System.IComparable")); } }
public void WhenDisposingReplacedTracerResult_ThenRevertsToExisting() { var tracer = new Mock <ITracer> { DefaultValue = DefaultValue.Mock }; using (TracerExtensibility.SetTracer(tracer.Object)) { } global::System.Diagnostics.Tracer.GetSourceFor <IComparable>(); tracer.Verify(x => x.GetSourceEntryFor("*"), Times.Never()); tracer.Verify(x => x.GetSourceEntryFor("System"), Times.Never()); tracer.Verify(x => x.GetSourceEntryFor("System.IComparable"), Times.Never()); }
public void WhenSettingNullTracer_ThenThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => TracerExtensibility.SetTracer(null)); }