- 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:
@ -7,14 +7,14 @@ using OI.Metrology.Shared.Models.Stateless;
|
||||
namespace OI.Metrology.Tests;
|
||||
|
||||
[TestClass]
|
||||
public class UnitTestInfinityQSController
|
||||
public class UnitTestInfinityQSController : 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
|
||||
@ -22,7 +22,6 @@ public class UnitTestInfinityQSController
|
||||
[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>>();
|
||||
@ -36,12 +35,19 @@ public class UnitTestInfinityQSController
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void TestCleanup()
|
||||
{
|
||||
if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed)
|
||||
IncrementFailedTests();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestControllerName()
|
||||
{
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.AreEqual(IInfinityQSController<string>.GetRouteName(), _ControllerName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -56,7 +62,7 @@ public class UnitTestInfinityQSController
|
||||
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
|
||||
string? result = infinityQSRepository?.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", "");
|
||||
Assert.IsNotNull(result);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -68,11 +74,11 @@ public class UnitTestInfinityQSController
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
Assert.IsNotNull(httpClient);
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/commandText/?sub_group_id=1677273357&process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 15:15:00");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json);
|
||||
Assert.IsNotNull(json);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -86,14 +92,12 @@ public class UnitTestInfinityQSController
|
||||
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
|
||||
Result<InfinityQSBase[]>? result = infinityQSRepository?.GetData("1677273357");
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsTrue(result?.Results.Length != 0);
|
||||
Assert.IsNotNull(result?.Results[0].PR_NAME);
|
||||
Assert.IsNotNull(result?.Results[0].SE_SGTM);
|
||||
Assert.IsNotNull(result?.Results[0].SE_TSNO);
|
||||
Assert.IsNotNull(result?.Results[0].TD_NAME);
|
||||
Assert.IsNotNull(result?.Results[0].TD_TEST);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsNotNull(result.Results);
|
||||
Assert.IsNotNull(result.Results[0].PR_NAME);
|
||||
Assert.IsNotNull(result.Results[0].TD_NAME);
|
||||
Assert.AreNotEqual(0, result.Results.Length);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -105,13 +109,13 @@ public class UnitTestInfinityQSController
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
Assert.IsNotNull(httpClient);
|
||||
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/data");
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/data");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json);
|
||||
Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -125,11 +129,12 @@ public class UnitTestInfinityQSController
|
||||
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
|
||||
Result<InfinityQSDescriptor[]>? result = infinityQSRepository?.GetDescriptors("1677273357");
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsTrue(result?.Results.Length != 0);
|
||||
Assert.IsNotNull(result?.Results[0].SD_SGRP);
|
||||
Assert.IsNotNull(result?.Results[0].SD_TSNO);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsNotNull(result.Results);
|
||||
Assert.IsNotNull(result.Results[0].SD_SGRP);
|
||||
Assert.IsNotNull(result.Results[0].SD_TSNO);
|
||||
Assert.AreNotEqual(0, result.Results.Length);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -141,13 +146,13 @@ public class UnitTestInfinityQSController
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
Assert.IsNotNull(httpClient);
|
||||
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/descriptors");
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/descriptors");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json);
|
||||
Result<InfinityQSDescriptor[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptor[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -162,7 +167,7 @@ public class UnitTestInfinityQSController
|
||||
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
|
||||
Result<InfinityQSEvent[]>? result = infinityQSRepository?.GetEvents("1677273357");
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -174,12 +179,12 @@ public class UnitTestInfinityQSController
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
Assert.IsNotNull(httpClient);
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/events");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEvents)}.json"), json);
|
||||
Result<InfinityQSEvent[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSEvent[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -194,7 +199,7 @@ public class UnitTestInfinityQSController
|
||||
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
|
||||
Result<InfinityQSBase[]>? result = infinityQSRepository?.GetHeader("1677273357");
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -206,12 +211,12 @@ public class UnitTestInfinityQSController
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
Assert.IsNotNull(httpClient);
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/header");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json);
|
||||
Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user