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

@ -37,6 +37,7 @@ public class UnitAwaitingDispoController
_Logger.Information($"{_TestContext?.TestName} completed");
}
[Ignore]
[TestMethod]
public void Index()
{
@ -48,18 +49,19 @@ public class UnitAwaitingDispoController
_Logger.Information($"{_TestContext?.TestName} completed");
}
[Ignore]
[TestMethod]
public async Task IndexApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(IMetrologyRepository.GetAwaitingDisposition)}Api.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(IMetrologyRepository.GetAwaitingDisposition)}Api.json"), json);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
[Ignore]
[TestMethod]
public void MarkAsReviewed()
{
_Logger.Information("Starting Web Application");
@ -69,8 +71,8 @@ public class UnitAwaitingDispoController
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
[Ignore]
[TestMethod]
public async Task MarkAsReviewedApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
@ -79,8 +81,8 @@ public class UnitAwaitingDispoController
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
[Ignore]
[TestMethod]
public void MarkAsAwaiting()
{
_Logger.Information("Starting Web Application");
@ -91,8 +93,8 @@ public class UnitAwaitingDispoController
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
[Ignore]
[TestMethod]
public async Task MarkAsAwaitingApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();

View File

@ -34,8 +34,8 @@ public class UnitInboundController
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
[Ignore]
[TestMethod]
public async Task DataApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
@ -44,8 +44,8 @@ public class UnitInboundController
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
[Ignore]
[TestMethod]
public async Task AttachFileApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();

View File

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using OI.Metrology.Server.Models;
using OI.Metrology.Shared.Models.Stateless;
using Serilog;
using System.Net;
@ -36,12 +37,22 @@ public class UnitTestAppSettingsController
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public void TestConnectionString()
{
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IAppSettingsRepository<Server.Models.Binder.AppSettings> appSettingsRepository = serviceProvider.GetRequiredService<IAppSettingsRepository<Server.Models.Binder.AppSettings>>();
appSettingsRepository.VerifyConnectionStrings();
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public void AppSettings()
{
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
Server.Models.AppSettings appSettings = serviceProvider.GetRequiredService<Server.Models.AppSettings>();
AppSettings appSettings = serviceProvider.GetRequiredService<AppSettings>();
Assert.IsNotNull(appSettings);
_Logger.Information($"{_TestContext?.TestName} completed");
}
@ -67,7 +78,7 @@ public class UnitTestAppSettingsController
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
string json = await httpResponseMessage.Content.ReadAsStringAsync();
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetAppSettingsApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetAppSettings)}.json"), json);
Assert.IsNotNull(json);
Assert.IsTrue(json != "[]");
_Logger.Information($"{_TestContext?.TestName} completed");
@ -94,7 +105,7 @@ public class UnitTestAppSettingsController
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
Assert.AreEqual("text/plain; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
string json = await httpResponseMessage.Content.ReadAsStringAsync();
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetBuildNumberAndGitCommitSevenApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetBuildNumberAndGitCommitSeven)}.json"), json);
Assert.IsNotNull(json);
_Logger.Information($"{_TestContext?.TestName} completed");
}

View File

@ -57,7 +57,7 @@ public class UnitTestClientSettingsController
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
string json = await httpResponseMessage.Content.ReadAsStringAsync();
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetClientSettingsApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetClientSettings)}.json"), json);
Assert.IsNotNull(json);
Assert.IsTrue(json != "[]");
_Logger.Information($"{_TestContext?.TestName} completed");
@ -84,7 +84,7 @@ public class UnitTestClientSettingsController
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
Assert.AreEqual("text/plain; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
string json = await httpResponseMessage.Content.ReadAsStringAsync();
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetIpAddressApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetIpAddress)}.json"), json);
Assert.IsNotNull(json);
_Logger.Information($"{_TestContext?.TestName} completed");
}

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");

View File

@ -0,0 +1,164 @@
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless;
using Serilog;
namespace OI.Metrology.Tests;
[TestClass]
public class UnitTestInfinityQSV2Controller
{
#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;
_Logger = Log.ForContext<UnitTestInfinityQSV2Controller>();
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
_ControllerName = nameof(Server.ApiControllers.InfinityQSV2Controller)[..^10];
}
[TestMethod]
public void TestControllerName()
{
_Logger.Information("Starting Web Application");
Assert.AreEqual(IInfinityQSV2Controller<string>.GetRouteName(), _ControllerName);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public void GetCommandText()
{
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IInfinityQSV2Repository infinityQSV2Repository = serviceProvider.GetRequiredService<IInfinityQSV2Repository>();
string result = infinityQSV2Repository.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", "");
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public async Task GetCommandTextApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/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.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public void GetData()
{
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IInfinityQSV2Repository infinityQSV2Repository = serviceProvider.GetRequiredService<IInfinityQSV2Repository>();
Result<InfinityQSBaseV2[]> result = infinityQSV2Repository.GetData("1677273357");
Assert.IsNotNull(result?.Results);
Assert.IsTrue(result?.Results.Any());
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.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public async Task GetDataApi()
{
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/data");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/data");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json);
Result<InfinityQSBaseV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBaseV2[]>>(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;
IInfinityQSV2Repository infinityQSV2Repository = serviceProvider.GetRequiredService<IInfinityQSV2Repository>();
Result<InfinityQSDescriptorV2[]> result = infinityQSV2Repository.GetDescriptors("1677273357");
Assert.IsNotNull(result?.Results);
Assert.IsTrue(result?.Results.Any());
Assert.IsNotNull(result?.Results[0].SubGroupId);
Assert.IsNotNull(result?.Results[0].SiteNumber);
_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<InfinityQSDescriptorV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptorV2[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public void GetEvents()
{
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IInfinityQSV2Repository infinityQSV2Repository = serviceProvider.GetRequiredService<IInfinityQSV2Repository>();
Result<InfinityQSEventV2[]> result = infinityQSV2Repository.GetEvents("1677273357");
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public async Task GetEventsApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/events");
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");
}
[TestMethod]
public void GetHeader()
{
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IInfinityQSV2Repository infinityQSV2Repository = serviceProvider.GetRequiredService<IInfinityQSV2Repository>();
Result<InfinityQSBaseV2[]> result = infinityQSV2Repository.GetHeader("1677273357");
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public async Task GetHeaderApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/header");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json);
Result<InfinityQSBaseV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBaseV2[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
}
}

View File

@ -54,7 +54,7 @@ public class UnitTestPinController
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/-1/pinned");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetPinnedTableApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetPinnedTable)}.json"), json);
Result<Pinned[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<Pinned[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");

View File

@ -68,7 +68,7 @@ public class UnitTestServiceShopOrderController
_Logger.Information("Starting Web Application");
string actionName = nameof(IServiceShopOrderController<object>.Action.All);
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/{actionName}");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetAllServiceShopOrdersApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetAllServiceShopOrders)}.json"), json);
ServiceShopOrder[]? serviceShopOrders = System.Text.Json.JsonSerializer.Deserialize<ServiceShopOrder[]>(json);
Assert.IsNotNull(serviceShopOrders);
Assert.IsTrue(serviceShopOrders.Any());

View File

@ -59,7 +59,7 @@ public class UnitTestToolTypesController
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(IndexApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(Index)}.json"), json);
Result<ToolTypeNameId[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<ToolTypeNameId[]>>(json);
Assert.IsNotNull(result?.Results);
Assert.IsTrue(result.Results.Any());
@ -88,7 +88,7 @@ public class UnitTestToolTypesController
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetToolTypeMetadataApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetToolTypeMetadata)}.json"), json);
Result<ToolTypeMetadataResult>? result = System.Text.Json.JsonSerializer.Deserialize<Result<ToolTypeMetadataResult>>(json);
Assert.IsNotNull(result?.Results);
Assert.IsNotNull(result.Results.Metadata);
@ -116,7 +116,7 @@ public class UnitTestToolTypesController
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1/headers");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetHeadersApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeaders)}.json"), json);
Result<DataTable>? result = Newtonsoft.Json.JsonConvert.DeserializeObject<Result<DataTable>>(json);
Assert.IsNotNull(result?.Results);
Assert.IsNotNull(result.Results.Rows.Count > 0);
@ -142,7 +142,7 @@ public class UnitTestToolTypesController
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/-1/headertitles");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetHeaderTitlesApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeaderTitles)}.json"), json);
Result<HeaderCommon[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
Assert.IsNotNull(result?.Results);
Assert.IsTrue(result.Results.Any());
@ -168,7 +168,7 @@ public class UnitTestToolTypesController
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1/headers/1/fields");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetHeaderFieldsApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeaderFields)}.json"), json);
Result<ColumnValue[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<ColumnValue[]>>(json);
Assert.IsNotNull(result?.Results);
Assert.IsTrue(result.Results.Any());
@ -194,13 +194,14 @@ public class UnitTestToolTypesController
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1/headers/1/data");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetDataApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json);
Result<DataTable>? result = Newtonsoft.Json.JsonConvert.DeserializeObject<Result<DataTable>>(json);
Assert.IsNotNull(result?.Results);
Assert.IsNotNull(result.Results.Rows.Count > 0);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[Ignore]
[TestMethod]
public void GetExportData()
{
@ -214,21 +215,22 @@ public class UnitTestToolTypesController
_Logger.Information($"{_TestContext?.TestName} completed");
}
[Ignore]
[TestMethod]
public async Task GetExportDataApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1/export");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetExportDataApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetExportData)}.json"), json);
Result<DataTable>? result = Newtonsoft.Json.JsonConvert.DeserializeObject<Result<DataTable>>(json);
Assert.IsNotNull(result?.Results);
Assert.IsNotNull(result.Results.Rows.Count > 0);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
[Ignore]
[TestMethod]
public void GetAttachment()
{
_Logger.Information("Starting Web Application");
@ -245,8 +247,8 @@ public class UnitTestToolTypesController
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
[Ignore]
[TestMethod]
public async Task GetAttachmentApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
@ -255,8 +257,8 @@ public class UnitTestToolTypesController
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
[Ignore]
[TestMethod]
public void OIExport()
{
_Logger.Information("Starting Web Application");
@ -269,8 +271,8 @@ public class UnitTestToolTypesController
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
[Ignore]
[TestMethod]
public async Task OIExportApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();