public async Task GetAsync_ExistingSequence_SequenceReturned() { var store = new DefaultSequenceStore(new IntegrationLoggerSubstitute <DefaultSequenceStore>()); var context = ConsumerPipelineContextHelper.CreateSubstitute(sequenceStore: store); await store.AddAsync(new ChunkSequence("aaa", 10, context)); await store.AddAsync(new ChunkSequence("bbb", 10, context)); await store.AddAsync(new ChunkSequence("ccc", 10, context)); var result = await store.GetAsync <ChunkSequence>("bbb"); result.Should().NotBeNull(); result !.SequenceId.Should().Be("bbb"); }
public async Task GetAsync_PartialId_SequenceReturnedIfMatchPrefixIsTrue(bool matchPrefix) { var store = new DefaultSequenceStore(new IntegrationLoggerSubstitute <DefaultSequenceStore>()); var context = ConsumerPipelineContextHelper.CreateSubstitute(sequenceStore: store); await store.AddAsync(new ChunkSequence("aaa-123", 10, context)); var result = await store.GetAsync <ChunkSequence>("aaa", matchPrefix); if (matchPrefix) { result.Should().NotBeNull(); result !.SequenceId.Should().Be("aaa-123"); } else { result.Should().BeNull(); } }