Skip to content

Commit

Permalink
Added a default "0.0.0" ProcessingVersion to entries if not set in Az…
Browse files Browse the repository at this point in the history
…ureTableStorageQueueItemRepositoryTests
  • Loading branch information
pawelvds committed Nov 28, 2024
1 parent dd0d632 commit 566c9a1
Showing 1 changed file with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,20 @@ public class AzureTableStorageQueueItemRepositoryTests : AbstractQueueItemReposi

public override async Task<IMiddlewareQueueItemRepository> CreateRepository(IEnumerable<ftQueueItem> entries)
{
var receiptReferenceIndexRepository = new AzureTableStorageReceiptReferenceIndexRepository(new QueueConfiguration { QueueId = _fixture.QueueId }, new TableServiceClient(Constants.AzureStorageConnectionString));
var azureQueueItemRepository = new AzureTableStorageQueueItemRepository(new QueueConfiguration { QueueId = _fixture.QueueId }, new TableServiceClient(Constants.AzureStorageConnectionString), receiptReferenceIndexRepository);
foreach (var entry in entries)
{
entry.ProcessingVersion ??= "0.0.0";
}

var receiptReferenceIndexRepository = new AzureTableStorageReceiptReferenceIndexRepository(
new QueueConfiguration { QueueId = _fixture.QueueId },
new TableServiceClient(Constants.AzureStorageConnectionString));

var azureQueueItemRepository = new AzureTableStorageQueueItemRepository(
new QueueConfiguration { QueueId = _fixture.QueueId },
new TableServiceClient(Constants.AzureStorageConnectionString),
receiptReferenceIndexRepository);

await SetQueueRowAndTimeStamp(entries.ToList());
foreach (var entry in entries)
{
Expand All @@ -42,11 +54,12 @@ public override async Task<IMiddlewareQueueItemRepository> CreateRepository(IEnu
public override async Task InsertOrUpdateAsync_ShouldUpdateEntry_IfEntryAlreadyExists()
{
var entries = StorageTestFixtureProvider.GetFixture().CreateMany<ftQueueItem>(10).ToList();

foreach (var entry in entries)
{
entry.ProcessingVersion = "0.0.0";
entry.ProcessingVersion ??= "0.0.0";
}

var sut = await CreateRepository(entries);
var count = (await sut.GetAsync()).Count();
var entryToUpdate = await sut.GetAsync(entries[0].ftQueueItemId);
Expand All @@ -63,7 +76,15 @@ public override async Task InsertOrUpdateAsync_ShouldUpdateEntry_IfEntryAlreadyE
public override async Task GetQueueItemsForReceiptReferenceAsync_PosAndNonePosReceipts_ValidQueueItems()
{
_fixture.CleanTable(AzureTableStorageReceiptReferenceIndexRepository.TABLE_NAME);

var entries = StorageTestFixtureProvider.GetFixture().CreateMany<ftQueueItem>(10).ToList();

foreach (var entry in entries)
{
entry.ProcessingVersion ??= "0.0.0";
}

await base.GetQueueItemsForReceiptReferenceAsync_PosAndNonePosReceipts_ValidQueueItems();
}
}
}
}

0 comments on commit 566c9a1

Please sign in to comment.