From b123526778659fb38a83967225f34504ae5e277a Mon Sep 17 00:00:00 2001 From: Craig Edmunds Date: Fri, 3 Jan 2025 15:06:19 +0000 Subject: [PATCH] CDMS-200 switches country ched searching to use country of origin & refactoring of test fixtures (#40) * CDMS-200 switches country ched searching to use country of origin CDMS-200 Refactored no match tests to re-use code Refactoring Test Fixtures Switched Analytics MaxVersion tests to use new fixtures Some small refactoring to remove some generics CDMS-200 adds additional decision tests, moves alvs decision check analytics into context so it appears in audit entry Refactoring fixtures Refactoring fixtures * Finished refactoring of BaseTest class :fingers-crossed --- .../BaseTest.cs | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 TestGenerator.IntegrationTesting.Backend/BaseTest.cs diff --git a/TestGenerator.IntegrationTesting.Backend/BaseTest.cs b/TestGenerator.IntegrationTesting.Backend/BaseTest.cs new file mode 100644 index 00000000..9829350e --- /dev/null +++ b/TestGenerator.IntegrationTesting.Backend/BaseTest.cs @@ -0,0 +1,45 @@ +using Microsoft.Extensions.DependencyInjection; +using TestDataGenerator; +using TestGenerator.IntegrationTesting.Backend.Fixtures; +using Xunit; +using Xunit.Abstractions; + +namespace TestGenerator.IntegrationTesting.Backend; + +public abstract class BaseTest // : IClassFixture, IClassFixture + where T : ScenarioGenerator +{ + protected readonly BtmsClient Client; + protected readonly TestGeneratorFixture TestGeneratorFixture; + protected readonly BackendFixture BackendFixture; + // internal readonly BackendGeneratorFixture BackendGeneratorFixture; + protected readonly ITestOutputHelper TestOutputHelper; + + protected readonly List LoadedData; + protected BaseTest( + ITestOutputHelper testOutputHelper + ) + { + TestOutputHelper = testOutputHelper; + + TestGeneratorFixture = new TestGeneratorFixture(); + BackendFixture = new BackendFixture(testOutputHelper, GetType().Name); + + // BackendFixture.TestOutputHelper = testOutputHelper; + // BackendFixture.DatabaseName = GetType().Name; + // BackendFixture.Init(GetType().Name); + + Client = BackendFixture.BtmsClient; + + var data = TestGeneratorFixture.GenerateTestData(); + LoadedData = BackendFixture + .LoadTestData(data) + .GetAwaiter() + .GetResult(); + } + + protected async Task ClearDb() + { + await Client.ClearDb(); + } +} \ No newline at end of file