diff --git a/Server/ApiControllers/InfinityQSV3Controller.cs b/Server/ApiControllers/InfinityQSV3Controller.cs index db7f256..cf5081c 100644 --- a/Server/ApiControllers/InfinityQSV3Controller.cs +++ b/Server/ApiControllers/InfinityQSV3Controller.cs @@ -52,4 +52,11 @@ public class InfinityQSV3Controller : Controller, IInfinityQSV3Controller TableToPath, string URLs, string WorkingDirectoryName) diff --git a/Server/Models/Binder/AppSettings.cs b/Server/Models/Binder/AppSettings.cs index 8dfd42f..4a4759c 100644 --- a/Server/Models/Binder/AppSettings.cs +++ b/Server/Models/Binder/AppSettings.cs @@ -23,6 +23,7 @@ public class AppSettings public string? MonAResource { get; set; } public string? MonASite { get; set; } public string? Oi2SqlConnectionString { get; set; } + public string? OpenInsightApplicationProgrammingInterface { get; set; } public Dictionary? TableToPath { get; set; } public string? URLs { get; set; } public string? WorkingDirectoryName { get; set; } @@ -54,6 +55,7 @@ public class AppSettings if (appSettings.MonAResource is null) throw new NullReferenceException(nameof(MonAResource)); if (appSettings.MonASite is null) throw new NullReferenceException(nameof(MonASite)); if (appSettings.Oi2SqlConnectionString is null) throw new NullReferenceException(nameof(Oi2SqlConnectionString)); + if (appSettings.OpenInsightApplicationProgrammingInterface is null) throw new NullReferenceException(nameof(OpenInsightApplicationProgrammingInterface)); if (appSettings.URLs is null) throw new NullReferenceException(nameof(URLs)); if (appSettings.TableToPath is null) throw new NullReferenceException(nameof(TableToPath)); if (appSettings.WorkingDirectoryName is null) throw new NullReferenceException(nameof(WorkingDirectoryName)); @@ -75,6 +77,7 @@ public class AppSettings appSettings.MonAResource, appSettings.MonASite, appSettings.Oi2SqlConnectionString, + appSettings.OpenInsightApplicationProgrammingInterface, appSettings.TableToPath, appSettings.URLs, appSettings.WorkingDirectoryName); diff --git a/Server/Program.cs b/Server/Program.cs index da73757..3ae7d30 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -62,26 +62,26 @@ public class Program SQLDbConnectionFactory sqlDbConnectionFactory = new(appSettings); ClientSettingsRepository clientSettingsRepository = new(appSettings); + _ = webApplicationBuilder.Services.AddHttpClient(); _ = webApplicationBuilder.Services.AddSingleton(_ => appSettings); - _ = webApplicationBuilder.Services.AddSingleton(); - _ = webApplicationBuilder.Services.AddSingleton(); - _ = webApplicationBuilder.Services.AddSingleton(_ => clientSettingsRepository); - _ = webApplicationBuilder.Services.AddSingleton(); - _ = webApplicationBuilder.Services.AddSingleton(_ => new(appSettings.MockRoot)); - _ = webApplicationBuilder.Services.AddSingleton(_ => sqlDbConnectionFactory); - _ = webApplicationBuilder.Services.AddSingleton(_ => new(appSettings.MockRoot)); - _ = webApplicationBuilder.Services.AddSingleton(); - _ = webApplicationBuilder.Services.AddSingleton>(_ => appSettingsRepository); - _ = webApplicationBuilder.Services.AddSingleton(_ => new(appSettings.MockRoot, sqlDbConnectionFactory)); - _ = webApplicationBuilder.Services.AddSingleton(_ => new(appSettings.MockRoot, sqlDbConnectionFactory)); - _ = webApplicationBuilder.Services.AddSingleton(_ => new(appSettings.MockRoot, sqlDbConnectionFactory)); - _ = webApplicationBuilder.Services.AddSingleton(_ => new(appSettings.MockRoot, sqlDbConnectionFactory)); - + _ = webApplicationBuilder.Services.AddSingleton(); _ = webApplicationBuilder.Services.AddScoped(); _ = webApplicationBuilder.Services.AddScoped(); _ = webApplicationBuilder.Services.AddScoped(); + _ = webApplicationBuilder.Services.AddSingleton(); _ = webApplicationBuilder.Services.AddScoped(); + _ = webApplicationBuilder.Services.AddSingleton(); + _ = webApplicationBuilder.Services.AddSingleton(); + _ = webApplicationBuilder.Services.AddSingleton(); _ = webApplicationBuilder.Services.AddScoped(); + _ = webApplicationBuilder.Services.AddSingleton(); + _ = webApplicationBuilder.Services.AddSingleton(); + _ = webApplicationBuilder.Services.AddSingleton(); + _ = webApplicationBuilder.Services.AddSingleton(_ => clientSettingsRepository); + _ = webApplicationBuilder.Services.AddSingleton(); + _ = webApplicationBuilder.Services.AddSingleton(); + _ = webApplicationBuilder.Services.AddSingleton(_ => sqlDbConnectionFactory); + _ = webApplicationBuilder.Services.AddSingleton>(_ => appSettingsRepository); _ = webApplicationBuilder.Services.AddSwaggerGen(); _ = webApplicationBuilder.Services.AddSession(sessionOptions => diff --git a/Server/Repositories/InfinityQSRepository.cs b/Server/Repositories/InfinityQSRepository.cs index 783fca5..8c3bdd9 100644 --- a/Server/Repositories/InfinityQSRepository.cs +++ b/Server/Repositories/InfinityQSRepository.cs @@ -1,3 +1,4 @@ +using OI.Metrology.Server.Models; using OI.Metrology.Shared.DataModels; using OI.Metrology.Shared.Models.Stateless; using OI.Metrology.Shared.Repositories; @@ -15,9 +16,9 @@ public class InfinityQSRepository : IInfinityQSRepository private readonly string _RepositoryName; private readonly IDbConnectionFactory _DBConnectionFactory; - public InfinityQSRepository(string mockRoot, IDbConnectionFactory dbConnectionFactory) + public InfinityQSRepository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory) { - _MockRoot = mockRoot; + _MockRoot = appSettings.MockRoot; _DBConnectionFactory = dbConnectionFactory; _RepositoryName = nameof(InfinityQSRepository)[..^10]; } diff --git a/Server/Repositories/InfinityQSV2Repository.cs b/Server/Repositories/InfinityQSV2Repository.cs index 6366cb1..6328a86 100644 --- a/Server/Repositories/InfinityQSV2Repository.cs +++ b/Server/Repositories/InfinityQSV2Repository.cs @@ -1,3 +1,4 @@ +using OI.Metrology.Server.Models; using OI.Metrology.Shared.DataModels; using OI.Metrology.Shared.Models.Stateless; using OI.Metrology.Shared.Repositories; @@ -15,9 +16,9 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository private readonly string _RepositoryName; private readonly IDbConnectionFactory _DBConnectionFactory; - public InfinityQSV2Repository(string mockRoot, IDbConnectionFactory dbConnectionFactory) + public InfinityQSV2Repository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory) { - _MockRoot = mockRoot; + _MockRoot = appSettings.MockRoot; _DBConnectionFactory = dbConnectionFactory; _RepositoryName = nameof(InfinityQSV2Repository)[..^10]; } diff --git a/Server/Repositories/InfinityQSV3Repository.cs b/Server/Repositories/InfinityQSV3Repository.cs index 0d60f88..7ae0ac3 100644 --- a/Server/Repositories/InfinityQSV3Repository.cs +++ b/Server/Repositories/InfinityQSV3Repository.cs @@ -1,6 +1,9 @@ +using OI.Metrology.Server.Models; using OI.Metrology.Shared.DataModels; +using OI.Metrology.Shared.Models; using OI.Metrology.Shared.Models.Stateless; using OI.Metrology.Shared.Repositories; +using System.Collections.ObjectModel; using System.Data; using System.Data.Common; using System.Text; @@ -13,13 +16,17 @@ public class InfinityQSV3Repository : IInfinityQSV3Repository private readonly string _MockRoot; private readonly string _RepositoryName; + private readonly IHttpClientFactory _HttpClientFactory; private readonly IDbConnectionFactory _DBConnectionFactory; + private readonly string _OpenInsightApplicationProgrammingInterface; - public InfinityQSV3Repository(string mockRoot, IDbConnectionFactory dbConnectionFactory) + public InfinityQSV3Repository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory, IHttpClientFactory httpClientFactory) { - _MockRoot = mockRoot; + _MockRoot = appSettings.MockRoot; + _HttpClientFactory = httpClientFactory; _DBConnectionFactory = dbConnectionFactory; _RepositoryName = nameof(InfinityQSV3Repository)[..^10]; + _OpenInsightApplicationProgrammingInterface = appSettings.OpenInsightApplicationProgrammingInterface; } string IInfinityQSV3Repository.GetCommandText(string subGroupId) @@ -318,4 +325,131 @@ public class InfinityQSV3Repository : IInfinityQSV3Repository return result.ToString(); } + private JsonElement[] GetAllReactorsAsJsonElementElement() + { + JsonElement[]? results; + HttpClient httpClient = _HttpClientFactory.CreateClient(); + Task task = httpClient.GetStringAsync($"{_OpenInsightApplicationProgrammingInterface}/reactors"); + task.Wait(); + JsonElement? jsonElement = JsonSerializer.Deserialize(task.Result); + if (jsonElement is null) + throw new NullReferenceException(nameof(jsonElement)); + string json = jsonElement.Value.EnumerateObject().First().Value.ToString(); + results = JsonSerializer.Deserialize(json); + if (results is null) + throw new NullReferenceException(nameof(results)); + return results; + } + + private ReadOnlyDictionary GetReactorsMatchingType(string? reactTypeFilter) + { + Dictionary results = new(); + string json; + Reactor? reactor; + JsonElement[]? jsonElements = GetAllReactorsAsJsonElementElement(); + foreach (JsonElement jsonElement in jsonElements) + { + json = jsonElement.EnumerateObject().First().Value.ToString(); + if (reactTypeFilter is not null && !json.Contains(reactTypeFilter)) + continue; + try + { reactor = JsonSerializer.Deserialize(json, ReactorSourceGenerationContext.Default.Reactor); } + catch (Exception) { reactor = null; } + if (reactor is null || reactor.ReactType != reactTypeFilter) + continue; + results.Add(reactor.ReactorNo, reactor); + } + return new(results); + } + + string IInfinityQSV3Repository.GetCommandText(List eppReactorNumbers) + { + StringBuilder result = new(); + _ = result + .AppendLine(" select se.f_sgrp, ") + .AppendLine(" dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgrp), '19700101'))) date_time, ") + .AppendLine(" iq.pr_name, ") + .AppendLine(" iq.pd_name, ") + .AppendLine(" max(case ") + .AppendLine(" when td.f_test = 1104769646 ") + .AppendLine(" then se.f_val ") + .AppendLine(" else null ") + .AppendLine(" end) as iq_value, ") + .AppendLine(" max(case ") + .AppendLine(" when td.f_test = 1312288843 ") + .AppendLine(" then se.f_val else null ") + .AppendLine(" end) as iq_temp_offset_percent ") + .AppendLine(" from ( ") + .AppendLine(" select ") + .AppendLine(" max(se.f_sgrp) se_max_sgrp, ") + .AppendLine(" se.f_test se_test, ") + .AppendLine(" pr.f_name pr_name, ") + .AppendLine(" pd.f_name pd_name ") + .AppendLine(" from [spcepiworld].[dbo].[sgrp_ext] se ") + .AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ") + .AppendLine(" on se.f_prcs = pr.f_prcs ") + .AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ") + .AppendLine(" on se.f_part = pd.f_part ") + .AppendLine(" where se.f_flag = 0 ") + .Append(" and pr.f_name in (").Append(string.Join(',', eppReactorNumbers)).AppendLine(") ") + .AppendLine(" and pd.f_name = '1090 - Full Load' ") + .AppendLine(" and se.f_test in (1104769646, 1312288843) ") + .AppendLine(" group by se.f_test, ") + .AppendLine(" pr.f_name, ") + .AppendLine(" pd.f_name ") + .AppendLine(" ) as iq ") + .AppendLine(" join [spcepiworld].[dbo].[sgrp_ext] se ") + .AppendLine(" on iq.se_max_sgrp = se.f_sgrp ") + .AppendLine(" join [spcepiworld].[dbo].[test_dat] td ") + .AppendLine(" on iq.se_test = td.f_test ") + .AppendLine(" and se.f_test = td.f_test ") + .AppendLine(" where se.f_flag = 0 ") + .AppendLine(" and td.f_test in (1104769646, 1312288843) ") + .AppendLine(" group by se.f_sgrp, ") + .AppendLine(" iq.pr_name, ") + .AppendLine(" iq.pd_name ") + .AppendLine(" order by se.f_sgrp desc ") + .AppendLine(" for json path; "); + return result.ToString(); + } + + string IInfinityQSV3Repository.GetEpiProTempVerification() + { + StringBuilder result; + List eppReactorNumbers = new(); + ReadOnlyDictionary eppReactors = GetReactorsMatchingType("EPP"); + foreach (KeyValuePair keyValuePair in eppReactors) + eppReactorNumbers.Add($"'{keyValuePair.Key}'"); + if (!string.IsNullOrEmpty(_MockRoot)) + { + string html = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV3Repository.GetEpiProTempVerification)}.html")); + result = new(html); + } + else + { + result = new(); + Reactor? reactor; + IInfinityQSV3Repository infinityQSV3Repository = this; + string commandText = infinityQSV3Repository.GetCommandText(eppReactorNumbers); + StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText); + InfinityQS1090FullLoad[]? results = stringBuilder.Length == 0 ? Array.Empty() : JsonSerializer.Deserialize(stringBuilder.ToString(), InfinityQS1090FullLoadArraySourceGenerationContext.Default.InfinityQS1090FullLoadArray); + if (results is null) + throw new NullReferenceException(nameof(results)); + foreach (InfinityQS1090FullLoad infinityQS1090FullLoad in results) + { + if (infinityQS1090FullLoad.Reactor is null || !eppReactors.TryGetValue(infinityQS1090FullLoad.Reactor.Value, out reactor)) + continue; + _ = result.Append(""). + Append("").Append(reactor.ReactorNo).Append(""). + Append("").Append(reactor.E10State).Append(""). + Append("").Append(reactor.LoadedRDS.Count == 0 ? "" : reactor.LoadedRDS[0]).Append(""). + Append("").Append(infinityQS1090FullLoad.Value).Append(""). + Append("").Append(infinityQS1090FullLoad.TemperatureOffsetPercentage).Append(""). + Append("").Append(infinityQS1090FullLoad.SubGroupIdFormated).Append(""). + Append(""); + } + } + return result.ToString(); + } + } \ No newline at end of file diff --git a/Server/Repositories/PinRepository.cs b/Server/Repositories/PinRepository.cs index 2478d4d..a3892f2 100644 --- a/Server/Repositories/PinRepository.cs +++ b/Server/Repositories/PinRepository.cs @@ -1,3 +1,4 @@ +using OI.Metrology.Server.Models; using OI.Metrology.Shared.DataModels; using OI.Metrology.Shared.Models.Stateless; using System.Text.Json; @@ -11,9 +12,9 @@ public class PinRepository : IPinRepository private readonly string _RepositoryName; private readonly Dictionary> _RdsToHeaderCommonCollection; - public PinRepository(string mockRoot) + public PinRepository(AppSettings appSettings) { - _MockRoot = mockRoot; + _MockRoot = appSettings.MockRoot; _RdsToHeaderCommonCollection = new(); _RepositoryName = nameof(PinRepository)[..^10]; } diff --git a/Server/Repositories/ServiceShopOrderRepository.cs b/Server/Repositories/ServiceShopOrderRepository.cs index e2e3ce2..928b669 100644 --- a/Server/Repositories/ServiceShopOrderRepository.cs +++ b/Server/Repositories/ServiceShopOrderRepository.cs @@ -7,11 +7,6 @@ namespace OI.Metrology.Server.Repository; public class ServiceShopOrderRepository : IServiceShopOrderRepository { - private readonly ILogger _Logger; - - public ServiceShopOrderRepository(ILogger logger) => - _Logger = logger; - private static ServiceShopOrder[] GetServiceShopOrders(Shared.Models.ServiceShop? serviceShop) { ServiceShopOrder[] result = IServiceShopOrder.GetServiceShopOrders(serviceShop); diff --git a/Server/Repositories/ToolTypesRepository.cs b/Server/Repositories/ToolTypesRepository.cs index 52d00bb..f8dbc09 100644 --- a/Server/Repositories/ToolTypesRepository.cs +++ b/Server/Repositories/ToolTypesRepository.cs @@ -1,3 +1,4 @@ +using OI.Metrology.Server.Models; using OI.Metrology.Shared.DataModels; using OI.Metrology.Shared.Models.Stateless; using OI.Metrology.Shared.Services; @@ -13,9 +14,9 @@ public class ToolTypesRepository : IToolTypesRepository private readonly string _MockRoot; private readonly string _RepositoryName; - public ToolTypesRepository(string mockRoot) + public ToolTypesRepository(AppSettings appSettings) { - _MockRoot = mockRoot; + _MockRoot = appSettings.MockRoot; _RepositoryName = nameof(ToolTypesRepository)[..^10]; } diff --git a/Server/Repositories/WorkMaterialRepository.cs b/Server/Repositories/WorkMaterialRepository.cs index abaa6ce..2f44c8b 100644 --- a/Server/Repositories/WorkMaterialRepository.cs +++ b/Server/Repositories/WorkMaterialRepository.cs @@ -1,3 +1,4 @@ +using OI.Metrology.Server.Models; using OI.Metrology.Shared.DataModels; using OI.Metrology.Shared.Models.Stateless; using OI.Metrology.Shared.Repositories; @@ -16,9 +17,9 @@ public class WorkMaterialRepository : IWorkMaterialRepository private readonly string _RepositoryName; private readonly IDbConnectionFactory _DBConnectionFactory; - public WorkMaterialRepository(string mockRoot, IDbConnectionFactory dbConnectionFactory) + public WorkMaterialRepository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory) { - _MockRoot = mockRoot; + _MockRoot = appSettings.MockRoot; _DBConnectionFactory = dbConnectionFactory; _RepositoryName = nameof(WorkMaterialRepository)[..^10]; } diff --git a/Shared/DataModels/InfinityQSEpp.cs b/Shared/DataModels/InfinityQSEpp.cs new file mode 100644 index 0000000..002e52e --- /dev/null +++ b/Shared/DataModels/InfinityQSEpp.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; + +namespace OI.Metrology.Shared.DataModels; + +public record InfinityQS1090FullLoad([property: JsonPropertyName("se_sgrp")] int SubGroupId, + [property: JsonPropertyName("se_date_time")] DateTime SubGroupIdFormated, + [property: JsonPropertyName("pr_name")] int? Reactor, + [property: JsonPropertyName("pd_name")] int? Part, + [property: JsonPropertyName("se_value")] int Value, + [property: JsonPropertyName("se_temp_offset_percent")] int TemperatureOffsetPercentage); + +[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] +[JsonSerializable(typeof(InfinityQS1090FullLoad))] +public partial class InfinityQS1090FullLoadSourceGenerationContext : JsonSerializerContext +{ +} + +[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] +[JsonSerializable(typeof(Result))] +public partial class InfinityQS1090FullLoadArraySourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/Shared/Models/Reactor.cs b/Shared/Models/Reactor.cs new file mode 100644 index 0000000..d95f65e --- /dev/null +++ b/Shared/Models/Reactor.cs @@ -0,0 +1,43 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace OI.Metrology.Shared.Models; + +public record Reactor( + [property: JsonPropertyName("reactorNo")] int ReactorNo, + [property: JsonPropertyName("reactType")] string ReactType, + [property: JsonPropertyName("reactAssignment")] string ReactAssignment, + [property: JsonPropertyName("pickPlace")] bool PickPlace, + [property: JsonPropertyName("loadLockDown")] string LoadLockDown, + [property: JsonPropertyName("0311Active")] bool _0311Active, + [property: JsonPropertyName("loadedRDS")] IReadOnlyList LoadedRDS, + [property: JsonPropertyName("isRunning")] bool IsRunning, + [property: JsonPropertyName("outOfProdDTM")] string OutOfProdDTM, + [property: JsonPropertyName("workOrder")] int? WorkOrder, + [property: JsonPropertyName("workOrderCustomer")] string WorkOrderCustomer, + [property: JsonPropertyName("currMode")] string CurrMode, + [property: JsonPropertyName("serviceDesc")] string ServiceDesc, + [property: JsonPropertyName("e10State")] string E10State + ) +{ + + public override string ToString() + { + string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); + return result; + } + +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Reactor))] +public partial class ReactorSourceGenerationContext : JsonSerializerContext +{ +} + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(Reactor[]))] +public partial class ReactorCollectionSourceGenerationContext : JsonSerializerContext +{ +} + diff --git a/Shared/Models/Stateless/IInfinityQSV3Controller.cs b/Shared/Models/Stateless/IInfinityQSV3Controller.cs index 998ab92..f110835 100644 --- a/Shared/Models/Stateless/IInfinityQSV3Controller.cs +++ b/Shared/Models/Stateless/IInfinityQSV3Controller.cs @@ -10,8 +10,11 @@ public interface IInfinityQSV3Controller } static string GetRouteName() => nameof(IInfinityQSV3Controller)[1..^10]; - T GetCommandText(string sub_group_id, string process, string job, string part, string lot, string date_time); + T GetEpiProTempVerification(); T GetData(string sub_group_id); T GetHeader(string sub_group_id); + T GetDescriptors(string sub_group_id); + T GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe); + T GetCommandText(string sub_group_id, string process, string job, string part, string lot, string date_time); } \ No newline at end of file diff --git a/Shared/Models/Stateless/IInfinityQSV3Repository.cs b/Shared/Models/Stateless/IInfinityQSV3Repository.cs index e6c95d8..02505ff 100644 --- a/Shared/Models/Stateless/IInfinityQSV3Repository.cs +++ b/Shared/Models/Stateless/IInfinityQSV3Repository.cs @@ -5,13 +5,15 @@ namespace OI.Metrology.Shared.Models.Stateless; public interface IInfinityQSV3Repository { + string GetEpiProTempVerification(); string GetCommandText(string subGroupId); - string GetCommandText(string process, string? part); string GetCommandText(InfinityQSV3 infinityQSV2); + Result GetData(string subGroupId); + Result GetHeader(string subGroupId); + string GetCommandText(string process, string? part); + string GetCommandText(List eppReactorNumbers); + Result GetDescriptors(string subGroupId); string GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe); string GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime); - Result GetData(string subGroupId); - Result GetDescriptors(string subGroupId); - Result GetHeader(string subGroupId); } \ No newline at end of file diff --git a/Tests/UnitTestInfinityQSV3Controller.cs b/Tests/UnitTestInfinityQSV3Controller.cs index 1793f88..06d765b 100644 --- a/Tests/UnitTestInfinityQSV3Controller.cs +++ b/Tests/UnitTestInfinityQSV3Controller.cs @@ -213,4 +213,35 @@ public class UnitTestInfinityQSV3Controller NonThrowTryCatch(); } +#if (!DEBUG) + [Ignore] +#endif + [TestMethod] + public void GetEpiProTempVerification() + { + _Logger?.LogInformation("Starting Web Application"); + IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; + IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService(); + string? result = infinityQSV3Repository?.GetEpiProTempVerification(); + Assert.IsNotNull(result); + _Logger?.LogInformation("{TestName} completed", _TestContext?.TestName); + NonThrowTryCatch(); + } + +#if (!DEBUG) + [Ignore] +#endif + [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"); + File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEpiProTempVerification)}.html"), result); + Assert.IsNotNull(result); + _Logger?.LogInformation("{TestName} completed", _TestContext?.TestName); + NonThrowTryCatch(); + } + } \ No newline at end of file