We have been looking at evolving our unit testing by stubbing IConnection so we can inject event history and action subscriptions etc on it, and then verify the results. It would be a really nice end to end verification mechanism.
I have implemented by own IConnection subscription
public EventStoreAllCatchUpSubscription SubscribeToAllFrom(Position? lastCheckpoint, CatchUpSubscriptionSettings settings,
Action<EventStoreCatchUpSubscription, ResolvedEvent> eventAppeared, Action liveProcessingStarted = null, Action<EventStoreCatchUpSubscription, SubscriptionDropReason, Exception> subscriptionDropped = null,
UserCredentials userCredentials = null)
{
// CreateInstance enabled to access protected methods
var subscription = (EventStoreAllCatchUpSubscription)Activator.CreateInstance(
typeof(EventStoreAllCatchUpSubscription),
BindingFlags.NonPublic | BindingFlags.Instance,
null,
new object[]
{
EventStoreServer.Connection,
new TestLogging(),
lastCheckpoint,
new UserCredentials(“user”, “pass”),
eventAppeared,
liveProcessingStarted,
subscriptionDropped,
settings
},
CultureInfo.InvariantCulture);
return subscription;
}
When I spin up the code that uses this (in an MSTest test), it runs ok, but just completes straight away, and none of the stream r/w methods are accessed (they should throw notImplemented if currently called).
Any advice you can give, or info you need to clarify