- 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:
@ -8,14 +8,14 @@ using OI.Metrology.Shared.Models.Stateless;
|
||||
namespace OI.Metrology.Tests;
|
||||
|
||||
[TestClass]
|
||||
public class UnitTestInfinityQSV4Controller
|
||||
public class UnitTestInfinityQSV4Controller : BaseTestClass
|
||||
{
|
||||
|
||||
#pragma warning disable CS8618
|
||||
|
||||
private static ILogger? _Logger;
|
||||
private static string _ControllerName;
|
||||
private static string? _TestContextTestName;
|
||||
public TestContext TestContext { get; set; }
|
||||
private static string _ControllerVersion;
|
||||
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||
|
||||
@ -24,7 +24,6 @@ public class UnitTestInfinityQSV4Controller
|
||||
[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>>();
|
||||
@ -39,13 +38,20 @@ public class UnitTestInfinityQSV4Controller
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void TestCleanup()
|
||||
{
|
||||
if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed)
|
||||
IncrementFailedTests();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestControllerName()
|
||||
{
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.AreEqual(IInfinityQSV4Controller<string>.GetRouteName(), _ControllerName);
|
||||
Assert.AreEqual(IInfinityQSV4Controller<string>.GetRouteVersion(), _ControllerVersion);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -57,7 +63,7 @@ public class UnitTestInfinityQSV4Controller
|
||||
IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>();
|
||||
string? result = infinityQSV4Repository?.GetCommandText("1718539249", "61", "CDE5", "5012", "575908", "");
|
||||
Assert.IsNotNull(result);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -66,11 +72,11 @@ public class UnitTestInfinityQSV4Controller
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
Assert.IsNotNull(httpClient);
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1718539249/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", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -81,14 +87,15 @@ public class UnitTestInfinityQSV4Controller
|
||||
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||
IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>();
|
||||
Result<InfinityQSV4[]>? result = infinityQSV4Repository?.GetData("1718539249");
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsTrue(result?.Results.Length != 0);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsNotNull(result.Results);
|
||||
Assert.AreNotEqual(0, result.Results.Length);
|
||||
Assert.IsNotNull(result?.Results[0].Process);
|
||||
Assert.IsNotNull(result?.Results[0].Variable);
|
||||
Assert.IsNotNull(result?.Results[0].SiteNumber);
|
||||
Assert.IsNotNull(result?.Results[0].VariableNumber);
|
||||
Assert.IsNotNull(result?.Results[0].SubGroupDateTime);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -97,13 +104,13 @@ public class UnitTestInfinityQSV4Controller
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
Assert.IsNotNull(httpClient);
|
||||
//string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1718539249 575908_2023-02-24 14-18-05.txt/data");
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1718539249/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);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -114,11 +121,12 @@ public class UnitTestInfinityQSV4Controller
|
||||
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||
IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>();
|
||||
Result<InfinityQSDescriptorV4[]>? result = infinityQSV4Repository?.GetDescriptors("1718539249");
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsTrue(result?.Results.Length != 0);
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsNotNull(result.Results);
|
||||
Assert.AreNotEqual(0, result.Results.Length);
|
||||
Assert.IsNotNull(result?.Results[0].SubGroupId);
|
||||
Assert.IsNotNull(result?.Results[0].SiteNumber);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -127,13 +135,13 @@ public class UnitTestInfinityQSV4Controller
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
Assert.IsNotNull(httpClient);
|
||||
//string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1718539249 575908_2023-02-24 14-18-05.txt/descriptors");
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1718539249/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);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -146,7 +154,7 @@ public class UnitTestInfinityQSV4Controller
|
||||
Result<InfinityQSV4[]>? result = infinityQSV4Repository?.GetHeader("1718539249");
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsNotNull(result?.Results[0].Part);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -155,13 +163,13 @@ public class UnitTestInfinityQSV4Controller
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
Assert.IsNotNull(httpClient);
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1718539249/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);
|
||||
Assert.IsNotNull(result?.Results[0].Part);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -173,7 +181,7 @@ public class UnitTestInfinityQSV4Controller
|
||||
IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>();
|
||||
string? result = infinityQSV4Repository?.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma("41", "8IN_THIN ROTR");
|
||||
Assert.IsNotNull(result);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -182,11 +190,11 @@ public class UnitTestInfinityQSV4Controller
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
Assert.IsNotNull(httpClient);
|
||||
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", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -199,7 +207,7 @@ public class UnitTestInfinityQSV4Controller
|
||||
IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>();
|
||||
List<string[]>? results = infinityQSV4Repository?.GetEpiProTempVerificationRows(night);
|
||||
Assert.IsNotNull(results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -208,11 +216,11 @@ public class UnitTestInfinityQSV4Controller
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
Assert.IsNotNull(httpClient);
|
||||
string? result = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/epi-pro-temp-verification-rows/?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", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -225,7 +233,7 @@ public class UnitTestInfinityQSV4Controller
|
||||
IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>();
|
||||
string? result = infinityQSV4Repository?.GetEpiProTempVerification(night);
|
||||
Assert.IsNotNull(result);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -234,11 +242,11 @@ public class UnitTestInfinityQSV4Controller
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
Assert.IsNotNull(httpClient);
|
||||
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", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -250,7 +258,7 @@ public class UnitTestInfinityQSV4Controller
|
||||
IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>();
|
||||
List<Reactor>? results = infinityQSV4Repository?.GetReactors();
|
||||
Assert.IsNotNull(results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -266,7 +274,7 @@ public class UnitTestInfinityQSV4Controller
|
||||
result = infinityQSV4Repository?.GetProductionSpecification(part);
|
||||
Assert.IsNotNull(result);
|
||||
}
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -298,7 +306,7 @@ public class UnitTestInfinityQSV4Controller
|
||||
result = infinityQSV4Repository?.GetProductionSpecification(part);
|
||||
Assert.IsNotNull(result);
|
||||
}
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -313,7 +321,7 @@ public class UnitTestInfinityQSV4Controller
|
||||
IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>();
|
||||
string? result = infinityQSV4Repository?.GetLastGroupIdWithValue(process, part, test);
|
||||
Assert.IsNotNull(result);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -325,11 +333,11 @@ public class UnitTestInfinityQSV4Controller
|
||||
const string process = "35";
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
Assert.IsNotNull(httpClient);
|
||||
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", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user