Dynamic 5 and 14 point copy

AppSettings alignment with other projects

_TestContextTestName over _TestContext
This commit is contained in:
2025-05-02 15:22:18 -07:00
parent 2afb312065
commit 6f52566fc2
30 changed files with 415 additions and 326 deletions

View File

@ -13,7 +13,7 @@ public class UnitTestISpreadingResistanceProfileController
private static ILogger? _Logger;
private static string _ControllerName;
private static TestContext _TestContext;
private static string? _TestContextTestName;
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
#pragma warning restore
@ -21,7 +21,7 @@ public class UnitTestISpreadingResistanceProfileController
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext)
{
_TestContext = testContext;
_TestContextTestName = testContext.TestName;
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
@ -40,7 +40,7 @@ public class UnitTestISpreadingResistanceProfileController
{
_Logger?.LogInformation("Starting Web Application");
Assert.AreEqual(ISpreadingResistanceProfileController<string>.GetRouteName(), _ControllerName);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
NonThrowTryCatch();
}
@ -62,7 +62,7 @@ public class UnitTestISpreadingResistanceProfileController
Assert.IsTrue(bytes.Length != 0);
File.WriteAllBytes(Path.Combine(directory, "srp.png"), bytes);
}
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
NonThrowTryCatch();
}