PDSF (Process Data Standard Format) to use EAF for

pushing to OI
This commit is contained in:
2023-07-24 13:29:13 -07:00
parent 6668806432
commit 4cc5219409
28 changed files with 268 additions and 329 deletions

View File

@ -1,6 +1,8 @@
using Microsoft.AspNetCore.Mvc.Testing;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless;
using Serilog;
using System.Text;
namespace OI.Metrology.Tests;
@ -26,22 +28,37 @@ public class UnitInboundController
_ControllerName = nameof(Server.ApiControllers.InboundController)[..^10];
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod]
public void TestControllerName()
{
_Logger.Information("Starting Web Application");
Assert.AreEqual(IInboundController<string>.GetRouteName(), _ControllerName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
private static InboundCommon GetInboundCommon() =>
new() { PSN = "5008", Reactor = "61", RDS = "579487", Id = 1678209360, ProcessDataStandardFormat = @"\\server\share\file.ext" };
private static StringContent GetStringContent() =>
new(System.Text.Json.JsonSerializer.Serialize(GetInboundCommon()), Encoding.UTF8, "application/json");
[Ignore]
[TestMethod]
public async Task DataApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
_ = await httpClient.PostAsync($"api/{_ControllerName}/a", null);
_ = await httpClient.PostAsync($"api/{_ControllerName}/BioRad", GetStringContent());
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[Ignore]
@ -50,8 +67,9 @@ public class UnitInboundController
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
_ = await httpClient.PostAsync($"api/{_ControllerName}/a/attachment", null);
_ = await httpClient.PostAsync($"api/{_ControllerName}/BioRad/attachment", GetStringContent());
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
}