public void GetActivityIdShouldReturnEmptyGuid() { using (EventActivityScope scope1 = new EventActivityScope()) { Assert.AreEqual(Guid.Empty, scope1.PreviousActivityId); } }
public void NewScopeWithExistingActivityIdShouldUseCorrectActivityId() { Guid externalGuid = Guid.Parse("c2cbe3e9-53ee-440c-b16b-2dec89df7202"); using (EventActivityScope scope1 = new EventActivityScope(externalGuid)) { Assert.AreEqual(scope1.ActivityId, externalGuid); } }
public void ReuseScopeShouldReuseActivityId() { using (EventActivityScope scope1 = new EventActivityScope()) { // make sure we don't have an outer activity, but do have an inner activity Assert.AreEqual(Guid.Empty, scope1.PreviousActivityId); Assert.AreNotEqual(Guid.Empty, scope1.ActivityId); using (EventActivityScope scope2 = new EventActivityScope(true)) { Assert.AreEqual(scope1.ActivityId, scope2.PreviousActivityId); Assert.AreEqual(scope1.ActivityId, scope2.ActivityId); } } }
public void ReuseScopeShouldReuseExternalActivityId() { Guid externalGuid = Guid.Parse("b423a74f-f5c7-4707-8555-552567ec446a"); using (EventActivityScope scope1 = new EventActivityScope(externalGuid)) { Assert.AreEqual(scope1.ActivityId, externalGuid); // make sure we don't have an outer activity, but do have an inner activity Assert.AreEqual(Guid.Empty, scope1.PreviousActivityId); Assert.AreNotEqual(Guid.Empty, scope1.ActivityId); using (EventActivityScope scope2 = new EventActivityScope(true)) { Assert.AreEqual(scope1.ActivityId, scope2.PreviousActivityId); Assert.AreEqual(scope1.ActivityId, scope2.ActivityId); } } }
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); }
public void NewScopeShouldGenerateNewActivityIdWhenParentHasExternalActivityId() { Guid externalGuid = Guid.Parse("adc174e5-6f7b-4280-a4a4-8d8550ab4f89"); using (EventActivityScope scope1 = new EventActivityScope(externalGuid)) { Assert.AreEqual(scope1.ActivityId, externalGuid); // make sure we don't have an outer activity, but do have an inner activity Assert.AreEqual(Guid.Empty, scope1.PreviousActivityId); Assert.AreNotEqual(Guid.Empty, scope1.ActivityId); using (EventActivityScope scope2 = new EventActivityScope()) { Assert.AreEqual(scope1.ActivityId, scope2.PreviousActivityId); Assert.AreNotEqual(scope1.ActivityId, scope2.ActivityId); } } }
public void NewScopeWithExternalActivityIdShouldUseCorrectActivityId() { Guid externalGuid = Guid.Parse("64a49a09-c775-4a91-b4ec-91a9a6e3caeb"); using (EventActivityScope scope1 = new EventActivityScope()) { // make sure we don't have an outer activity, but do have an inner activity Assert.AreEqual(Guid.Empty, scope1.PreviousActivityId); Assert.AreNotEqual(Guid.Empty, scope1.ActivityId); using (EventActivityScope scope2 = new EventActivityScope(externalGuid)) { Assert.AreEqual(scope2.ActivityId, externalGuid); Assert.AreEqual(scope1.ActivityId, scope2.PreviousActivityId); Assert.AreNotEqual(scope1.ActivityId, scope2.ActivityId); } } }