public void GivenChain_WhenContainsDuplicateLinks_ThenAllAreCalled() { var chain = LocalChainFactory <MyRequest> .Initialize() .StartWith(Handle1) .FollowedBy(Handle2) .FollowedBy(Handle1) .Build(); var request = new MyRequest(); chain.Handle(request); request.Visited.Should() .NotBeEmpty() .And.HaveCount(3) .And.ContainInOrder(new[] { nameof(Handle1), nameof(Handle2), nameof(Handle1) }); }
public void GivenChain_WhenOnlyFirstTwoShouldBeCalled_ThenOnlyFirstTwoAreCalled() { _checkpoint2 = true; var chain = LocalChainFactory <MyRequest> .Initialize() .StartWith(Handle1) .FollowedBy(Handle2) .FollowedBy(Handle3) .Build(); var request = new MyRequest(); chain.Handle(request); request.Visited.Should() .NotBeEmpty() .And.HaveCount(2) .And.ContainInOrder(new[] { nameof(Handle1), nameof(Handle2) }); }