- 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:
@ -6,14 +6,14 @@ using OI.Metrology.Shared.Models.Stateless;
|
||||
namespace OI.Metrology.Tests;
|
||||
|
||||
[TestClass]
|
||||
public class UnitTestOpenInsightV1Controller
|
||||
public class UnitTestOpenInsightV1Controller : 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<Server.Program>? _WebApplicationFactory;
|
||||
|
||||
#pragma warning restore
|
||||
@ -21,7 +21,6 @@ public class UnitTestOpenInsightV1Controller
|
||||
[ClassInitialize]
|
||||
public static void ClassInitAsync(TestContext testContext)
|
||||
{
|
||||
_TestContextTestName = testContext.TestName;
|
||||
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||
@ -35,12 +34,19 @@ public class UnitTestOpenInsightV1Controller
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void TestCleanup()
|
||||
{
|
||||
if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed)
|
||||
IncrementFailedTests();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestControllerName()
|
||||
{
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.AreEqual(IOpenInsightV1Controller<string>.GetRouteName(), _ControllerName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -51,7 +57,7 @@ public class UnitTestOpenInsightV1Controller
|
||||
IOpenInsightV1Repository? openInsightRepository = serviceProvider?.GetRequiredService<IOpenInsightV1Repository>();
|
||||
string? result = openInsightRepository?.GetTencorRun("615071", "10/30/2023 06:48:34PM", "6IN_EPP ROTR");
|
||||
Assert.IsNotNull(result);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -60,11 +66,11 @@ public class UnitTestOpenInsightV1Controller
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
Assert.IsNotNull(httpClient);
|
||||
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/615071/tencor-run?insert_date=10/30/2023 06:48:34PM&recipe=6IN_EPP ROTR");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetTencorRun)}.json"), result);
|
||||
Assert.IsNotNull(result);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user