From 566c9a186101e89ea0ef3ed38df818bda6580c62 Mon Sep 17 00:00:00 2001 From: PawelKarczewski Date: Fri, 29 Nov 2024 00:01:56 +0100 Subject: [PATCH] Added a default "0.0.0" ProcessingVersion to entries if not set in AzureTableStorageQueueItemRepositoryTests --- ...ureTableStorageQueueItemRepositoryTests.cs | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/queue/test/fiskaltrust.Middleware.Storage.AzureTableStorage.AcceptanceTest/AzureTableStorageQueueItemRepositoryTests.cs b/queue/test/fiskaltrust.Middleware.Storage.AzureTableStorage.AcceptanceTest/AzureTableStorageQueueItemRepositoryTests.cs index e6b1504f1..09e98fc93 100644 --- a/queue/test/fiskaltrust.Middleware.Storage.AzureTableStorage.AcceptanceTest/AzureTableStorageQueueItemRepositoryTests.cs +++ b/queue/test/fiskaltrust.Middleware.Storage.AzureTableStorage.AcceptanceTest/AzureTableStorageQueueItemRepositoryTests.cs @@ -26,8 +26,20 @@ public class AzureTableStorageQueueItemRepositoryTests : AbstractQueueItemReposi public override async Task CreateRepository(IEnumerable 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) { @@ -42,11 +54,12 @@ public override async Task CreateRepository(IEnu public override async Task InsertOrUpdateAsync_ShouldUpdateEntry_IfEntryAlreadyExists() { var entries = StorageTestFixtureProvider.GetFixture().CreateMany(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); @@ -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(10).ToList(); + + foreach (var entry in entries) + { + entry.ProcessingVersion ??= "0.0.0"; + } + await base.GetQueueItemsForReceiptReferenceAsync_PosAndNonePosReceipts_ValidQueueItems(); } } -} +} \ No newline at end of file