- Include root in valid directories

- AppSetting bug fix

- Updated testes with base test class and editor configuration changes

- Created new server and wafer counter tasks json files and pipelines to match
This commit is contained in:
2025-07-29 16:56:09 -07:00
parent 6f52566fc2
commit a427c5648a
49 changed files with 1680 additions and 822 deletions

View File

@ -7,14 +7,14 @@ using OI.Metrology.Shared.Models.Stateless;
namespace OI.Metrology.Tests;
[TestClass]
public class UnitTestWaferCounterController
public class UnitTestWaferCounterController : BaseTestClass
{
#pragma warning disable CS8618
private static ILogger? _Logger;
private static string _ControllerName;
private static string? _TestContextTestName;
public TestContext TestContext { get; set; }
private static WebApplicationFactory<Wafer.Counter.Program>? _WebApplicationFactory;
#pragma warning restore
@ -22,7 +22,6 @@ public class UnitTestWaferCounterController
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext)
{
_TestContextTestName = testContext.TestName;
_WebApplicationFactory = new WebApplicationFactory<Wafer.Counter.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Wafer.Counter.Program>>();
@ -36,12 +35,19 @@ public class UnitTestWaferCounterController
catch (Exception) { }
}
[TestCleanup]
public void TestCleanup()
{
if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed)
IncrementFailedTests();
}
[TestMethod]
public void TestControllerName()
{
_Logger?.LogInformation("Starting Web Application");
Assert.AreEqual(IFileShareController<string>.GetRouteName(), _ControllerName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
Assert.AreEqual(IWaferCounterController<string>.GetRouteName(), _ControllerName);
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
NonThrowTryCatch();
}
@ -54,7 +60,7 @@ public class UnitTestWaferCounterController
IWaferCounterRepository? waferCounterRepository = serviceProvider?.GetRequiredService<IWaferCounterRepository>();
WaferCounter? result = waferCounterRepository?.GetLastQuantityAndSlotMap(area: "FQA", waferSize: "8INCH", text: "Test");
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
NonThrowTryCatch();
}
@ -64,10 +70,10 @@ public class UnitTestWaferCounterController
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
Assert.IsNotNull(httpClient);
string? response = await httpClient.GetStringAsync($"api/v1/{_ControllerName}/FQA/last-quantity-and-slot-map/?waferSize=8INCH&text=Test");
Assert.IsNotNull(response);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
NonThrowTryCatch();
}