public void LogActivity_Complete_writes_current_method_name() { var methodName = MethodBase.GetCurrentMethod().Name; var observer = new Mock<IObserver<LogEntry>>(); observer .Setup( o => o.OnNext( It.Is<LogEntry>( e => e.CallingMethod == methodName && e.EventType == TraceEventType.Stop))); var helper = new AsyncTestHelper(); using (var activity = Log.Enter(() => { })) using (TestHelper.LogToConsole()) using (observer.Object.SubscribeToLogEvents()) { var result = helper.BeginSomething( _ => activity.Complete(() => { }), activity); helper.EndSomething(result); } observer.VerifyAll(); }
public void LogActivity_Complete_writes_current_method_name() { var methodName = MethodBase.GetCurrentMethod().Name; var observer = new Mock <IObserver <LogEntry> >(); observer .Setup( o => o.OnNext( It.Is <LogEntry>( e => e.CallingMethod == methodName && e.EventType == TraceEventType.Stop))); var helper = new AsyncTestHelper(); using (var activity = Log.Enter(() => { })) using (TestHelper.LogToConsole()) using (observer.Object.SubscribeToLogEvents()) { var result = helper.BeginSomething( _ => activity.Complete(() => { }), activity); helper.EndSomething(result); } observer.VerifyAll(); }
public void LogActivity_Trace_captures_current_method_name() { var observer = new Mock <IObserver <LogEntry> >(); observer.Setup(o => o.OnNext( It.Is <LogEntry>( e => e.CallingMethod.Contains("BeginSomething")))); observer.Setup(o => o.OnNext( It.Is <LogEntry>( e => e.CallingMethod.Contains("EndSomething")))); var helper = new AsyncTestHelper(); using (var activity = Log.Enter(() => { })) using (TestHelper.LogToConsole()) using (observer.Object.SubscribeToLogEvents()) { var result = helper.BeginSomething( _ => activity.Complete(() => { }), activity); helper.EndSomething(result); } observer.VerifyAll(); }
public void LogActivity_Trace_captures_current_method_name() { var observer = new Mock<IObserver<LogEntry>>(); observer.Setup(o => o.OnNext( It.Is<LogEntry>( e => e.CallingMethod.Contains("BeginSomething")))); observer.Setup(o => o.OnNext( It.Is<LogEntry>( e => e.CallingMethod.Contains("EndSomething")))); var helper = new AsyncTestHelper(); using (var activity = Log.Enter(() => { })) using (TestHelper.LogToConsole()) using (observer.Object.SubscribeToLogEvents()) { var result = helper.BeginSomething( _ => activity.Complete(() => { }), activity); helper.EndSomething(result); } observer.VerifyAll(); }