Skip to content

Commit

Permalink
CDMS-200 switches country ched searching to use country of origin & r…
Browse files Browse the repository at this point in the history
…efactoring 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
  • Loading branch information
craigedmunds authored and Lim Sim committed Jan 14, 2025
1 parent 5c709b8 commit b123526
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions TestGenerator.IntegrationTesting.Backend/BaseTest.cs
Original file line number Diff line number Diff line change
@@ -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<T> // : IClassFixture<TestGeneratorFixture>, IClassFixture<BackendFixture>
where T : ScenarioGenerator
{
protected readonly BtmsClient Client;
protected readonly TestGeneratorFixture TestGeneratorFixture;
protected readonly BackendFixture BackendFixture;
// internal readonly BackendGeneratorFixture<T> BackendGeneratorFixture;
protected readonly ITestOutputHelper TestOutputHelper;

protected readonly List<GeneratedResult> 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<T>();
LoadedData = BackendFixture
.LoadTestData(data)
.GetAwaiter()
.GetResult();
}

protected async Task ClearDb()
{
await Client.ClearDb();
}
}

0 comments on commit b123526

Please sign in to comment.