- 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 UnitTestInfinityQSV3Controller
|
||||
public class UnitTestInfinityQSV3Controller : 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 UnitTestInfinityQSV3Controller
|
||||
[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 UnitTestInfinityQSV3Controller
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void TestCleanup()
|
||||
{
|
||||
if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed)
|
||||
IncrementFailedTests();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestControllerName()
|
||||
{
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.AreEqual(IInfinityQSV3Controller<string>.GetRouteName(), _ControllerName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -53,7 +59,7 @@ public class UnitTestInfinityQSV3Controller
|
||||
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
|
||||
string? result = infinityQSV3Repository?.GetCommandText("1698497987", "61", "CDE5", "5012", "575908", "");
|
||||
Assert.IsNotNull(result);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -62,11 +68,11 @@ public class UnitTestInfinityQSV3Controller
|
||||
{
|
||||
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}/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", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -77,14 +83,15 @@ public class UnitTestInfinityQSV3Controller
|
||||
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
|
||||
Result<InfinityQSV3[]>? result = infinityQSV3Repository?.GetData("1698497987");
|
||||
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();
|
||||
}
|
||||
|
||||
@ -93,13 +100,13 @@ public class UnitTestInfinityQSV3Controller
|
||||
{
|
||||
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}/1698497987 575908_2023-02-24 14-18-05.txt/data");
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987/data");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json);
|
||||
Result<InfinityQSV3[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSV3[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -110,11 +117,12 @@ public class UnitTestInfinityQSV3Controller
|
||||
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
|
||||
Result<InfinityQSDescriptorV3[]>? result = infinityQSV3Repository?.GetDescriptors("1698497987");
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsTrue(result?.Results.Length != 0);
|
||||
Assert.IsNotNull(result?.Results[0].SubGroupId);
|
||||
Assert.IsNotNull(result?.Results[0].SiteNumber);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
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", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -123,13 +131,13 @@ public class UnitTestInfinityQSV3Controller
|
||||
{
|
||||
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}/1698497987 575908_2023-02-24 14-18-05.txt/descriptors");
|
||||
string? json = await httpClient.GetStringAsync($"api/{_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);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -142,7 +150,7 @@ public class UnitTestInfinityQSV3Controller
|
||||
Result<InfinityQSV3[]>? result = infinityQSV3Repository?.GetHeader("1698497987");
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsNotNull(result?.Results[0].Part);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -151,13 +159,13 @@ public class UnitTestInfinityQSV3Controller
|
||||
{
|
||||
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}/1698497987/header");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json);
|
||||
Result<InfinityQSV3[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSV3[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsNotNull(result?.Results[0].Part);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -169,7 +177,7 @@ public class UnitTestInfinityQSV3Controller
|
||||
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
|
||||
string? result = infinityQSV3Repository?.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma("41", "8IN_THIN ROTR");
|
||||
Assert.IsNotNull(result);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -178,11 +186,11 @@ public class UnitTestInfinityQSV3Controller
|
||||
{
|
||||
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}/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();
|
||||
}
|
||||
|
||||
@ -195,7 +203,7 @@ public class UnitTestInfinityQSV3Controller
|
||||
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
|
||||
List<string[]>? results = infinityQSV3Repository?.GetEpiProTempVerificationRows(night);
|
||||
Assert.IsNotNull(results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -204,11 +212,11 @@ public class UnitTestInfinityQSV3Controller
|
||||
{
|
||||
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}/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();
|
||||
}
|
||||
|
||||
@ -221,7 +229,7 @@ public class UnitTestInfinityQSV3Controller
|
||||
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
|
||||
string? result = infinityQSV3Repository?.GetEpiProTempVerification(night);
|
||||
Assert.IsNotNull(result);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -230,11 +238,11 @@ public class UnitTestInfinityQSV3Controller
|
||||
{
|
||||
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}/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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user