From 759e12edf19f16b20d47dcea59f22c3c99fa805a Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Wed, 11 Dec 2024 15:23:47 +0000 Subject: [PATCH] move test rejectors out of src --- .../CohortExtractor/RequestFulfillers/RejectAll.cs | 14 -------------- .../RequestFulfillers/RejectNone.cs | 14 -------------- ...romCataloguesExtractionRequestFulfillerTests.cs | 10 ++++++++++ .../MicroservicesIntegrationTest.cs | 12 +++++++++++- 4 files changed, 21 insertions(+), 29 deletions(-) delete mode 100644 src/SmiServices/Microservices/CohortExtractor/RequestFulfillers/RejectAll.cs delete mode 100644 src/SmiServices/Microservices/CohortExtractor/RequestFulfillers/RejectNone.cs diff --git a/src/SmiServices/Microservices/CohortExtractor/RequestFulfillers/RejectAll.cs b/src/SmiServices/Microservices/CohortExtractor/RequestFulfillers/RejectAll.cs deleted file mode 100644 index 12eafb1ba..000000000 --- a/src/SmiServices/Microservices/CohortExtractor/RequestFulfillers/RejectAll.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Data; -using System.Diagnostics.CodeAnalysis; - -namespace SmiServices.Microservices.CohortExtractor.RequestFulfillers -{ - public class RejectAll : IRejector - { - public bool Reject(IDataRecord row, [NotNullWhen(true)] out string? reason) - { - reason = "Rejector is " + nameof(RejectAll); - return true; - } - } -} diff --git a/src/SmiServices/Microservices/CohortExtractor/RequestFulfillers/RejectNone.cs b/src/SmiServices/Microservices/CohortExtractor/RequestFulfillers/RejectNone.cs deleted file mode 100644 index 53b0df142..000000000 --- a/src/SmiServices/Microservices/CohortExtractor/RequestFulfillers/RejectNone.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Data; -using System.Diagnostics.CodeAnalysis; - -namespace SmiServices.Microservices.CohortExtractor.RequestFulfillers -{ - public class RejectNone : IRejector - { - public bool Reject(IDataRecord row, [NotNullWhen(true)] out string? reason) - { - reason = null; - return false; - } - } -} diff --git a/tests/SmiServices.IntegrationTests/Microservices/CohortExtractor/FromCataloguesExtractionRequestFulfillerTests.cs b/tests/SmiServices.IntegrationTests/Microservices/CohortExtractor/FromCataloguesExtractionRequestFulfillerTests.cs index df5c6f9ba..93f0115f1 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/CohortExtractor/FromCataloguesExtractionRequestFulfillerTests.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/CohortExtractor/FromCataloguesExtractionRequestFulfillerTests.cs @@ -10,6 +10,7 @@ using SmiServices.UnitTests.Common; using System.Collections.Generic; using System.Data; +using System.Diagnostics.CodeAnalysis; using System.Linq; using Tests.Common; @@ -159,5 +160,14 @@ public void Test_FromCataloguesExtractionRequestFulfiller_NoFilterExtraction(Dat Assert.That(matching, Has.Length.EqualTo(1)); Assert.That(matching[0].Accepted, Has.Count.EqualTo(expected)); } + + private class RejectAll : IRejector + { + public bool Reject(IDataRecord row, [NotNullWhen(true)] out string? reason) + { + reason = "Rejector is " + nameof(RejectAll); + return true; + } + } } } diff --git a/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/MicroservicesIntegrationTest.cs b/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/MicroservicesIntegrationTest.cs index 330366f7a..2e4a91fdb 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/MicroservicesIntegrationTest.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/MicroservicesIntegrationTest.cs @@ -41,6 +41,7 @@ using SmiServices.IntegrationTests.Common; using SmiServices.UnitTests.Microservices.DicomRelationalMapper; using SmiServices.UnitTests.TestCommon; +using System.Diagnostics.CodeAnalysis; namespace SmiServices.IntegrationTests.Microservices.DicomRelationalMapper { @@ -189,7 +190,7 @@ public void IntegrationTest_Rejector(DatabaseType databaseType, Type? rejector) _globals.DicomRelationalMapperOptions.QoSPrefetchCount = 5000; _globals.DicomRelationalMapperOptions.DatabaseNamerType = typeof(GuidDatabaseNamer).FullName; - _globals.CohortExtractorOptions!.RejectorType = rejector?.FullName; + _globals.CohortExtractorOptions!.RejectorType = rejector?.Name; _globals.FileSystemOptions!.DicomSearchPattern = "*"; @@ -626,5 +627,14 @@ public override void ClearCache() { } return null; } } + + private class RejectAll : IRejector + { + public bool Reject(IDataRecord row, [NotNullWhen(true)] out string? reason) + { + reason = "Rejector is " + nameof(RejectAll); + return true; + } + } } }