Delete Work Material

Added InfinityQSV3-GetEpiProTempVerification
Added nigth shift
This commit is contained in:
2023-11-13 09:44:37 -07:00
parent 03bd20fc8c
commit cff2e06f68
27 changed files with 419 additions and 769 deletions

View File

@ -57,9 +57,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetCommandTextApi()
{
@ -73,9 +70,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void GetData()
{
@ -94,9 +88,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetDataApi()
{
@ -112,9 +103,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void GetDescriptors()
{
@ -130,9 +118,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetDescriptorsApi()
{
@ -148,9 +133,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void GetHeader()
{
@ -164,9 +146,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetHeaderApi()
{
@ -182,9 +161,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void GetProductDataAverageSumOfDefectsProcessMeanProcessSigma()
{
@ -197,9 +173,6 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetProductDataAverageSumOfDefectsProcessMeanProcessSigmaApi()
{
@ -213,4 +186,30 @@ public class UnitTestInfinityQSV3Controller
NonThrowTryCatch();
}
[TestMethod]
public void GetEpiProTempVerification()
{
_Logger?.LogInformation("Starting Web Application");
int[] night = new int[] { 44, 46, 52, 54 };
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
string? result = infinityQSV3Repository?.GetEpiProTempVerification(night);
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
[TestMethod]
public async Task GetEpiProTempVerificationApi()
{
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");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEpiProTempVerification)}.html"), result);
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -1,80 +0,0 @@
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless;
namespace OI.Metrology.Tests;
[TestClass]
public class UnitTestWorkMaterialController
{
#pragma warning disable CS8618
private static ILogger? _Logger;
private static string _ControllerName;
private static TestContext _TestContext;
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
#pragma warning restore
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext)
{
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
_ControllerName = nameof(Server.ApiControllers.WorkMaterialController)[..^10];
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod]
public void TestControllerName()
{
_Logger?.LogInformation("Starting Web Application");
Assert.AreEqual(IWorkMaterialController<string>.GetRouteName(), _ControllerName);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void GetCassette()
{
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IWorkMaterialRepository? workMaterialRepository = serviceProvider?.GetRequiredService<IWorkMaterialRepository>();
Result<WorkMaterialV2[]>? result = workMaterialRepository?.GetCassette("O171927.1.37");
Assert.IsNotNull(result?.Results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public async Task GetCassetteApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/O171927.1.37/");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCassette)}.json"), json);
Result<WorkMaterialV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<WorkMaterialV2[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}