NginxFileSystem

Remove Reactors and Working Directory
AppSettings
This commit is contained in:
2024-03-18 12:59:15 -07:00
parent 127634f5ab
commit 811f45a7df
33 changed files with 499 additions and 530 deletions

View File

@ -47,7 +47,7 @@ public class UnitTestExportController
}
private static HeaderCommon GetHeaderCommon() =>
new() { PSN = "5008", Reactor = "61", RDS = "579487", ID = 1678209360 };
new() { PSN = "5131", Reactor = "23", RDS = "631836", ID = 1710783849 };
private static StringContent GetStringContent() =>
new(System.Text.Json.JsonSerializer.Serialize(GetHeaderCommon()), Encoding.UTF8, "application/json");

View File

@ -1,13 +1,12 @@
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 UnitTestReactorController
public class UnitTestFileShareController
{
#pragma warning disable CS8618
@ -26,7 +25,7 @@ public class UnitTestReactorController
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
_ControllerName = nameof(Server.ApiControllers.ReactorsController)[..^10];
_ControllerName = nameof(Server.ApiControllers.FileShareController)[..^10];
}
private static void NonThrowTryCatch()
@ -40,46 +39,45 @@ public class UnitTestReactorController
public void TestControllerName()
{
_Logger?.LogInformation("Starting Web Application");
Assert.AreEqual(IReactorsController<string>.GetRouteName(), _ControllerName);
Assert.AreEqual(IFileShareController<string>.GetRouteName(), _ControllerName);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
[Ignore]
[TestMethod]
public void GetReactors()
{
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IReactorsRepository? reactorsRepository = serviceProvider?.GetRequiredService<IReactorsRepository>();
Result<int[]>? result = reactorsRepository?.EvenReactors();
Assert.IsNotNull(result?.Results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
[TestMethod]
public async Task GetReactorsApi()
public async Task CopyFileApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/true/");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetReactors)}.json"), json);
Result<int[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<int[]>>(json);
Assert.IsNotNull(result?.Results);
string? response = await httpClient.GetStringAsync($"api/v1/file-share/copy-file/?from=\\\\mesfs.infineon.com\\EC_Metrology_Si\\MetrologyAttachments\\CDERunHeader_\\2024\\WW11\\247233\\CDE5_240315162756858.pdsf&to=\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08RESIMAPCDE\\Test\\a.pdsf");
Assert.IsNotNull(response);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
[Ignore]
[TestMethod]
public async Task MoveFileApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? response = await httpClient.GetStringAsync($"api/v1/file-share/move-file/?from=\\\\mesfs.infineon.com\\EC_Metrology_Si\\MetrologyAttachments\\CDERunHeader_\\2024\\WW11\\247233\\CDE5_240315162756858.pdsf&to=\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08RESIMAPCDE\\Test\\a.pdsf");
Assert.IsNotNull(response);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
[TestMethod]
public void GetKey()
public async Task FileWriteApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IReactorsRepository? reactorsRepository = serviceProvider?.GetRequiredService<IReactorsRepository>();
WorkMaterialOut workMaterialOut = new() { RunDataSheet = "123456", Username = "phares" };
string? result = reactorsRepository?.GetKey(workMaterialOut, save: false);
Assert.IsNotNull(result);
Assert.IsTrue(httpClient is not null);
string? response = await httpClient.GetStringAsync($"api/v1/file-share/file-write/?path=\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08RESIMAPCDE\\Test\\b.pdsf&contents=b");
Assert.IsNotNull(response);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}

View File

@ -282,9 +282,9 @@ public class UnitTestInfinityQSV4Controller
List<string> production = new();
foreach (int rds in rdsCollection)
{
if (rds is 0)
continue;
production.Add("");
}
foreach (string part in new string[] { "4992" })
{

View File

@ -283,7 +283,7 @@ public class UnitTestToolTypesController
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
}
[Ignore]
// [Ignore]
[TestMethod]
public void OIExport()
{
@ -296,7 +296,7 @@ public class UnitTestToolTypesController
Assert.IsTrue(appSettings is not null);
Assert.IsTrue(attachmentsService is not null);
Assert.IsTrue(metrologyRepository is not null);
string? message = toolTypesRepository?.OIExport(metrologyRepository, attachmentsService, appSettings.AttachmentPath, appSettings.TableToPath, toolTypeId: 1, headerid: 1);
string? message = toolTypesRepository?.OIExport(metrologyRepository, attachmentsService, toolTypeId: 1, headerid: 1);
Assert.IsTrue(message is null);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
}

View File

@ -60,6 +60,10 @@ public class UnitTestWaferCounterController
Assert.AreEqual("0101010101010101010101010", result);
result = waferCounterRepository?.GetSlotMap("T13", "P1555555");
Assert.AreEqual("1010101010101010101010101", result);
result = waferCounterRepository?.GetSlotMap("T20", "P0EFFFF8");
Assert.AreEqual("0111011111111111111111000", result);
result = waferCounterRepository?.GetSlotMap("T20", "P07FFFF8");
Assert.AreEqual("0011111111111111111111000", result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
@ -70,7 +74,7 @@ public class UnitTestWaferCounterController
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IWaferCounterRepository? waferCounterRepository = serviceProvider?.GetRequiredService<IWaferCounterRepository>();
WaferCounter? result = waferCounterRepository?.GetLastQuantityAndSlotMap("EPP-East", "8INCH", "123456");
WaferCounter? result = waferCounterRepository?.GetLastQuantityAndSlotMap("EPP-East", "8INCH");
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();