示例#1
0
文件: Tests.cs 项目: jackyzhou/ZSharp
 public async Task NextMethodThrowsExceptionIfSequencyCanNotBeFound()
 {
     var stateProvider     = new InMemoryStateProvider();
     var sequenceGenerator = new SequenceGenerator(stateProvider);
     await Assert.ThrowsAsync <SequenceCouldNotBeFoundException>(() => sequenceGenerator.NextAsync(new SequenceKey {
         Value = "1234"
     }));
 }
示例#2
0
文件: Tests.cs 项目: jackyzhou/ZSharp
        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));
        }