diff --git a/Tests/LiquidProjections.PollingEventStore.Specs/PollingEventStoreAdapterSpecs.cs b/Tests/LiquidProjections.PollingEventStore.Specs/PollingEventStoreAdapterSpecs.cs index 119cf9a..eff6ecd 100644 --- a/Tests/LiquidProjections.PollingEventStore.Specs/PollingEventStoreAdapterSpecs.cs +++ b/Tests/LiquidProjections.PollingEventStore.Specs/PollingEventStoreAdapterSpecs.cs @@ -350,11 +350,7 @@ public class IPassiveEventStore eventStore = A.Fake(); A.CallTo(() => eventStore.GetFrom(A.Ignored)).ReturnsLazily(call => { - string checkpointString = call.GetArgument(0); - - long checkpoint = string.IsNullOrEmpty(checkpointString) - ? 0 - : long.Parse(checkpointString, CultureInfo.InvariantCulture); + long checkpoint = call.GetArgument(0) ?? 0; aSubscriptionStartedLoading.Set(); @@ -377,31 +373,24 @@ public class When(() => { - Subject( - 0, - new Subscriber - { - HandleTransactions = (transactions, info) => Task.FromResult(0) - }, - "firstId"); + Subject(0, new Subscriber + { + HandleTransactions = (transactions, info) => Task.FromResult(0) + }, "firstId"); if (!aSubscriptionStartedLoading.Wait(TimeSpan.FromSeconds(10))) { throw new InvalidOperationException("The first subscription has not started loading in 10 seconds."); } - Subject( - null, - new Subscriber + Subject(null, new Subscriber + { + HandleTransactions = (transactions, info) => { - HandleTransactions = (transactions, info) => - { - secondSubscriptionReceivedTheTransaction.Set(); - return Task.FromResult(0); - } - }, - "secondId" - ); + secondSubscriptionReceivedTheTransaction.Set(); + return Task.FromResult(0); + } + }, "secondId"); secondSubscriptionCreated.Set(); }); @@ -420,24 +409,23 @@ public void Then_the_second_subscription_should_not_hang() public class When_the_subscriber_cancels_the_subscription_from_inside_its_transaction_handler : GivenSubject { - private readonly TimeSpan pollingInterval = 500.Milliseconds(); - private readonly DateTime utcNow = DateTime.UtcNow; private readonly ManualResetEventSlim disposed = new ManualResetEventSlim(); public When_the_subscriber_cancels_the_subscription_from_inside_its_transaction_handler() { Given(() => { - UseThe(new TransactionBuilder().WithCheckpoint(123).Build()); - UseThe(A.Fake()); - A.CallTo(() => The().GetFrom(A.Ignored)).Returns(new[] { The() }); + A.CallTo(() => The().GetFrom(A.Ignored)).Returns(new[] + { + new TransactionBuilder().WithCheckpoint(123).Build() + }); - WithSubject(_ => new PollingEventStoreAdapter(The(), 11, pollingInterval, 100, - () => utcNow)); + WithSubject(_ => new PollingEventStoreAdapter(The(), 11, 500.Milliseconds(), 100, + () => DateTime.UtcNow)); }); - When(() => Subject.Subscribe(null, + When(() => Subject.Subscribe(0, new Subscriber { HandleTransactions = (transactions, info) =>