InfinityQSV2

This commit is contained in:
2023-02-25 12:39:34 -07:00
parent 8e15b6a3a5
commit 97c9c3c264
59 changed files with 142046 additions and 2119 deletions

View File

@ -53,7 +53,7 @@ public class UnitTestInfinityQSController
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
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, $"{nameof(GetCommandTextApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json);
Assert.IsNotNull(json);
_Logger.Information($"{_TestContext?.TestName} completed");
}
@ -67,7 +67,11 @@ public class UnitTestInfinityQSController
Result<InfinityQSBase[]> result = infinityQSRepository.GetData("1677273357");
Assert.IsNotNull(result?.Results);
Assert.IsTrue(result?.Results.Any());
Assert.IsNotNull(result?.Results[0].SubGroupDateTime);
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.Information($"{_TestContext?.TestName} completed");
}
@ -78,12 +82,39 @@ public class UnitTestInfinityQSController
_Logger.Information("Starting Web Application");
//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, $"{nameof(GetDataApi)}.json"), json);
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.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public void GetDescriptors()
{
_Logger.Information("Starting Web Application");
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.Any());
Assert.IsNotNull(result?.Results[0].SD_SGRP);
Assert.IsNotNull(result?.Results[0].SD_TSNO);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public async Task GetDescriptorsApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
//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.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public void GetEvents()
{
@ -101,7 +132,7 @@ public class UnitTestInfinityQSController
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/events");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetEventsApi)}.json"), json);
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.Information($"{_TestContext?.TestName} completed");
@ -124,7 +155,7 @@ public class UnitTestInfinityQSController
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/header");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetHeaderApi)}.json"), json);
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.Information($"{_TestContext?.TestName} completed");