diff --git a/src/NServiceBus.IntegrationTesting/IntegrationContext.cs b/src/NServiceBus.IntegrationTesting/IntegrationContext.cs index 56a28807..1f6ad968 100644 --- a/src/NServiceBus.IntegrationTesting/IntegrationContext.cs +++ b/src/NServiceBus.IntegrationTesting/IntegrationContext.cs @@ -8,9 +8,11 @@ namespace NServiceBus.IntegrationTesting { public class IntegrationContext : ScenarioContext { - ConcurrentBag invokedHandlers = new ConcurrentBag(); + readonly ConcurrentBag invokedHandlers = new ConcurrentBag(); + readonly ConcurrentBag invokedSagas = new ConcurrentBag(); public IEnumerable InvokedHandlers { get { return invokedHandlers; } } + public IEnumerable InvokedSagas { get { return invokedSagas; } } internal HandlerInvocation CaptureInvokedHandler(HandlerInvocation invocation) { @@ -19,11 +21,6 @@ internal HandlerInvocation CaptureInvokedHandler(HandlerInvocation invocation) return invocation; } - ConcurrentBag invokedSagas = new ConcurrentBag(); - - public IEnumerable InvokedSagas { get { return invokedSagas; } } - - internal SagaInvocation CaptureInvokedSaga(SagaInvocation invocation) { invokedSagas.Add(invocation); @@ -31,7 +28,7 @@ internal SagaInvocation CaptureInvokedSaga(SagaInvocation invocation) return invocation; } - static PropertyInfo GetCurrentProperty() + static PropertyInfo GetScenarioContextCurrentProperty() { return typeof(ScenarioContext).GetProperty("Current", BindingFlags.Static | BindingFlags.NonPublic); } @@ -40,7 +37,7 @@ public static IntegrationContext CurrentContext { get { - var pi = GetCurrentProperty(); + var pi = GetScenarioContextCurrentProperty(); var current = (IntegrationContext)pi.GetMethod.Invoke(null, null); return current;