Separated Wafer-Counter

JsonElement instead of Request body
Attachment Class
Bump
Ready to test GetLastGroupIdWithValue
Changed to v4
This commit is contained in:
2024-05-21 12:40:20 -07:00
parent 5c9f0d1aff
commit 6317c385f6
38 changed files with 1231 additions and 476 deletions

View File

@ -16,6 +16,7 @@ public class UnitTestInfinityQSV4Controller
private static ILogger? _Logger;
private static string _ControllerName;
private static TestContext _TestContext;
private static string _ControllerVersion;
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
#pragma warning restore
@ -27,7 +28,8 @@ public class UnitTestInfinityQSV4Controller
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
_ControllerName = nameof(Server.ApiControllers.InfinityQSV4Controller)[..^10];
_ControllerName = nameof(Server.ApiControllers.InfinityQSV4Controller)[..^12];
_ControllerVersion = nameof(Server.ApiControllers.InfinityQSV4Controller)[..^10][^2..];
}
private static void NonThrowTryCatch()
@ -42,6 +44,7 @@ public class UnitTestInfinityQSV4Controller
{
_Logger?.LogInformation("Starting Web Application");
Assert.AreEqual(IInfinityQSV4Controller<string>.GetRouteName(), _ControllerName);
Assert.AreEqual(IInfinityQSV4Controller<string>.GetRouteVersion(), _ControllerVersion);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
@ -64,7 +67,7 @@ public class UnitTestInfinityQSV4Controller
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987/commandText/?process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 15:15:00");
string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1698497987/commandText/?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", _TestContext?.TestName);
@ -95,8 +98,8 @@ public class UnitTestInfinityQSV4Controller
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987 575908_2023-02-24 14-18-05.txt/data");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987/data");
//string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1698497987 575908_2023-02-24 14-18-05.txt/data");
string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1698497987/data");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json);
Result<InfinityQSV4[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSV4[]>>(json);
Assert.IsNotNull(result?.Results);
@ -125,8 +128,8 @@ public class UnitTestInfinityQSV4Controller
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
//string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987 575908_2023-02-24 14-18-05.txt/descriptors");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987/descriptors");
//string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1698497987 575908_2023-02-24 14-18-05.txt/descriptors");
string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1698497987/descriptors");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json);
Result<InfinityQSDescriptorV3[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptorV3[]>>(json);
Assert.IsNotNull(result?.Results);
@ -153,7 +156,7 @@ public class UnitTestInfinityQSV4Controller
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987/header");
string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1698497987/header");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json);
Result<InfinityQSV4[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSV4[]>>(json);
Assert.IsNotNull(result?.Results);
@ -180,7 +183,7 @@ public class UnitTestInfinityQSV4Controller
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/41/product-data-average-sum-of-defects-process-mean-process-sigma?recipe=8IN_THIN ROTR");
string? result = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/41/product-data-average-sum-of-defects-process-mean-process-sigma?recipe=8IN_THIN ROTR");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetProductDataAverageSumOfDefectsProcessMeanProcessSigma)}.json"), result);
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
@ -206,7 +209,7 @@ public class UnitTestInfinityQSV4Controller
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/epi-pro-temp-verification-collection/?night=44&night=46&night=52&night=54");
string? result = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/epi-pro-temp-verification-collection/?night=44&night=46&night=52&night=54");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEpiProTempVerificationRows)}.json"), result);
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
@ -232,7 +235,7 @@ public class UnitTestInfinityQSV4Controller
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/epi-pro-temp-verification/?night=44&night=46&night=52&night=54");
string? result = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/epi-pro-temp-verification/?night=44&night=46&night=52&night=54");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEpiProTempVerification)}.html"), result);
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
@ -295,4 +298,35 @@ public class UnitTestInfinityQSV4Controller
NonThrowTryCatch();
}
[TestMethod]
public void GetLastGroupIdWithValue()
{
const string part = "4610";
const int test = 1228920625;
const string process = "35";
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>();
string? result = infinityQSV4Repository?.GetLastGroupIdWithValue(process, part, test);
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
[TestMethod]
public async Task GetLastGroupIdWithValueApi()
{
const string part = "4610";
const int test = 1228920625;
const string process = "35";
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? result = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/{process}/last-group-id-with-value/?part={part}&test={test}");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetLastGroupIdWithValue)}.html"), result);
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}