public async Task NextMethodThrowsExceptionIfSequencyCanNotBeFound() { var stateProvider = new InMemoryStateProvider(); var sequenceGenerator = new SequenceGenerator(stateProvider); await Assert.ThrowsAsync <SequenceCouldNotBeFoundException>(() => sequenceGenerator.NextAsync(new SequenceKey { Value = "1234" })); }
public async Task NextMethodThrowsExceptionWhenIfMaxRetryAttemptIsReach() { var stateProvider = new InMemoryStateProvider(); stateProvider.UpdateValue = false; var sequenceGenerator = new SequenceGenerator(stateProvider); var sequence = await CreateSequence(stateProvider); var sequenceKey = await stateProvider.AddAsync(sequence); await Assert.ThrowsAsync <MaxRetryAttemptReachedException>(() => sequenceGenerator.NextAsync(sequenceKey)); }