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

@ -15,7 +15,7 @@ public class UnitAwaitingDispoController
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
@ -23,7 +23,7 @@ public class UnitAwaitingDispoController
[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>>();
@ -35,7 +35,7 @@ public class UnitAwaitingDispoController
{
_Logger?.LogInformation("Starting Web Application");
Assert.AreEqual(IAwaitingDispoController<string>.GetRouteName(), _ControllerName);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
}
[Ignore]
@ -47,7 +47,7 @@ public class UnitAwaitingDispoController
IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>();
IEnumerable<AwaitingDisposition>? awaitingDispositions = metrologyRepository?.GetAwaitingDisposition();
Assert.IsTrue(awaitingDispositions is not null);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
}
[Ignore]
@ -59,7 +59,7 @@ public class UnitAwaitingDispoController
Assert.IsTrue(httpClient is not null);
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(IMetrologyRepository.GetAwaitingDisposition)}Api.json"), json);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
}
[Ignore]
@ -70,7 +70,7 @@ public class UnitAwaitingDispoController
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>();
_ = metrologyRepository?.UpdateReviewDate(toolTypeId: 1, headerId: 1, clearDate: false);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
}
[Ignore]
@ -81,7 +81,7 @@ public class UnitAwaitingDispoController
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
_ = await httpClient.GetFromJsonAsync<object>($"api/{_ControllerName}/markasreviewed");
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
}
[Ignore]
@ -93,7 +93,7 @@ public class UnitAwaitingDispoController
IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>();
int? dateCleared = metrologyRepository?.UpdateReviewDate(toolTypeId: 1, headerId: 1, clearDate: true);
Assert.IsTrue(dateCleared <= 1);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
}
[Ignore]
@ -104,7 +104,7 @@ public class UnitAwaitingDispoController
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
_ = await httpClient.PostAsync($"api/{_ControllerName}/markasawaiting", null);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
}
[TestMethod]
@ -115,7 +115,7 @@ public class UnitAwaitingDispoController
IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>();
Guid? guid = metrologyRepository?.GetHeaderAttachmentID(toolTypeId: 1, headerId: 1);
Assert.IsNotNull(guid);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
}
[TestMethod]
@ -126,7 +126,7 @@ public class UnitAwaitingDispoController
Assert.IsTrue(httpClient is not null);
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/1/header-attachment-id?headerid=1");
Assert.IsNotNull(httpResponseMessage.Content);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
}
}