public void CanReplay_CalledMultipleTimes_ExpectChainIsOnlyEnumeratedOnce()
 {
     var innerReplays = EnumerableTestDoubles.Mock<IReplayDomainEvents<object>>();
     var chain = new DomainEventReplayChain<object>(innerReplays);
     chain.CanReplay(new object(), new object());
     chain.CanReplay(new object(), new object());
     innerReplays.Received(1).GetEnumerator();
 }
 public void Replay_CalledWhenChainReturnsNullAggregateRoot_ExpectNullAggregateRootIsReturned()
 {
     var innerReplay = CreateReplayStubbedForCanReplay(Arg.Any<object>(), Arg.Any<object>(), null);
     var chain = new DomainEventReplayChain<object>(innerReplay);
     chain.Replay(new object(), new object()).Should().BeNull();
 }
 public void Replay_CalledWhenNoPartOfChainCanReplay_ExpectDomainEventCannotBeReplayedExceptionWithCorrectDomainEvent()
 {
     var domainEvent = new object();
     var innerReplay = CreateReplayStubbedForCanReplay(Arg.Any<object>(), Arg.Any<object>(), false);
     var chain = new DomainEventReplayChain<object>(innerReplay);
     chain.Invoking(x => x.Replay(new object(), domainEvent))
         .ShouldThrow<DomainEventCannotBeReplayedException>()
         .And.DomainEvent.Should().BeSameAs(domainEvent);
 }
 public void Replay_CalledMultipleTimes_ExpectChainIsOnlyEnumeratedOnce()
 {
     var innerReplays = EnumerableTestDoubles.Mock(CreateReplayStubbedForCanReplay(Arg.Any<object>(), Arg.Any<object>(), true));
     var chain = new DomainEventReplayChain<object>(innerReplays);
     chain.Replay(new object(), new object());
     chain.Replay(new object(), new object());
     innerReplays.Received(1).GetEnumerator();
 }