public void MethodInterfaceShouldCreateActivity() { Assert.AreEqual(Guid.Empty, EventActivityScope.CurrentActivityId); // this proxy does create a new activity scope var tester = new AutomaticActivity(); var proxy = TracingProxy.CreateWithActivityScope <AutomaticActivity>(tester); proxy.Method(); Assert.AreNotEqual(Guid.Empty, tester.ActivityId); Assert.AreEqual(Guid.Empty, EventActivityScope.CurrentActivityId); }
public void MethodThatThrowsShouldUnwindActivity() { Assert.AreEqual(Guid.Empty, EventActivityScope.CurrentActivityId); var tester = new AutomaticActivity(); var proxy = TracingProxy.Create <AutomaticActivity>(tester); try { proxy.Throws(); } catch { } Assert.AreEqual(Guid.Empty, EventActivityScope.CurrentActivityId); }
public void MethodInterfaceShouldNotChangeActivity() { Assert.AreEqual(Guid.Empty, EventActivityScope.CurrentActivityId); using (EventActivityScope scope = new EventActivityScope()) { Assert.AreNotEqual(Guid.Empty, EventActivityScope.CurrentActivityId); var tester = new AutomaticActivity(); var proxy = TracingProxy.Create <AutomaticActivity>(tester); proxy.Method(); Assert.AreEqual(scope.ActivityId, tester.ActivityId); Assert.AreEqual(scope.ActivityId, EventActivityScope.CurrentActivityId); } Assert.AreEqual(Guid.Empty, EventActivityScope.CurrentActivityId); }