private void AssertStartFailsAndDropsSubscriptionWithException(ApplicationException expectedException) { Assert.That(() => _subscription.StartAsync().Wait(TimeoutMs), Throws.TypeOf <AggregateException>()); Assert.That(_isDropped); Assert.That(_dropReason, Is.EqualTo(SubscriptionDropReason.CatchUpError)); Assert.That(_dropException, Is.SameAs(expectedException)); Assert.That(_liveProcessingStarted, Is.False); }
private async Task AssertStartFailsAndDropsSubscriptionWithException(ApplicationException expectedException) { await AssertEx.ThrowsAsync <ApplicationException>(() => _subscription.StartAsync()); Assert.That(_isDropped); Assert.That(_dropReason, Is.EqualTo(SubscriptionDropReason.CatchUpError)); Assert.That(_dropException, Is.SameAs(expectedException)); Assert.That(_liveProcessingStarted, Is.False); }
public EventStoreStreamCatchUpSubscription SubscribeToStreamFrom( string stream, long? lastCheckpoint, CatchUpSubscriptionSettings settings, Func<EventStoreCatchUpSubscription, ResolvedEvent, Task> eventAppeared, Action<EventStoreCatchUpSubscription> liveProcessingStarted = null, Action<EventStoreCatchUpSubscription, SubscriptionDropReason, Exception> subscriptionDropped = null, UserCredentials userCredentials = null) { Ensure.NotNullOrEmpty(stream, "stream"); Ensure.NotNull(settings, "settings"); Ensure.NotNull(eventAppeared, "eventAppeared"); var catchUpSubscription = new EventStoreStreamCatchUpSubscription(this, Settings.Log, stream, lastCheckpoint, userCredentials, eventAppeared, liveProcessingStarted, subscriptionDropped, settings); catchUpSubscription.StartAsync(); return catchUpSubscription; }