Refactor navigation links in Metrology static pages to update "FI Backlog" to "Reporting Services" with new URL.
- Updated links in the following files: - Static/Metrology/AwaitingDispo/index.html - Static/Metrology/Export/index.html - Static/Metrology/RunHeaders/index.html - Static/Metrology/RunInfo/index.html - Static/Metrology/index.html - Static/RunHeaders/index.html - Static/RunInfo/index.html - Static/awaiting-disposition.html - Static/export.html - Static/files.html - Static/index.html - Static/run-headers.html Removed obsolete HTTP request files from Tests/.vscode directory. - Deleted files: - tc_col_metrology-viewer-dev.http - tc_col_metrology-viewer-v1.http - tc_col_metrology-viewer-v2.http - tc_col_metrology-viewer-v3.http - tc_col_metrology-viewer-v4.http - tc_col_metrology-viewer.http - wafer-counter.http Added new HTTP request files for development and production environments. - Added files: - api-metrology-viewer-dev.http - api-metrology-viewer.http - api-v1-InfinityQS.http - api-v1-wafer-counter.http - api-v2-InfinityQS.http - api-v3-InfinityQS.http - api-v4-InfinityQS.http Updated Unit Tests for Inbound and WaferCounter controllers to reflect changes in repository methods and test scenarios. - Modified UnitTestWaferCounterController.cs to change area and wafer size parameters. - Removed UnitInboundController.cs and added new tests for InboundController functionality. Refactored FileShareRepository and WaferCounterRepository to improve file handling and data retrieval logic. - Updated methods to handle multiple file extensions and improve error handling. - Adjusted logic for retrieving last quantity and slot map based on file type. Added static pipeline configuration for deployment. - Created static-pipeline.yml for automated deployment process.
This commit is contained in:
85
Tests/UnitTestInboundController.cs
Normal file
85
Tests/UnitTestInboundController.cs
Normal file
@ -0,0 +1,85 @@
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OI.Metrology.Shared.DataModels;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using System.Text;
|
||||
|
||||
namespace OI.Metrology.Tests;
|
||||
|
||||
[TestClass]
|
||||
public class UnitTestInboundController : BaseTestClass
|
||||
{
|
||||
|
||||
#pragma warning disable CS8618
|
||||
|
||||
private static ILogger? _Logger;
|
||||
private static string _ControllerName;
|
||||
public TestContext TestContext { get; set; }
|
||||
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||
|
||||
#pragma warning restore
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitAsync(TestContext testContext)
|
||||
{
|
||||
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||
_ControllerName = nameof(Server.ApiControllers.InboundController)[..^10];
|
||||
}
|
||||
|
||||
private static void NonThrowTryCatch()
|
||||
{
|
||||
try
|
||||
{ throw new Exception(); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void TestCleanup()
|
||||
{
|
||||
if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed)
|
||||
IncrementFailedTests();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestControllerName()
|
||||
{
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.AreEqual(IInboundController<string>.GetRouteName(), _ControllerName);
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
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?.LogInformation("Starting Web Application");
|
||||
Assert.IsNotNull(httpClient);
|
||||
_ = await httpClient.PostAsync($"api/{_ControllerName}/BioRad", GetStringContent());
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[TestMethod]
|
||||
public async Task AttachFileApi()
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsNotNull(httpClient);
|
||||
_ = await httpClient.PostAsync($"api/{_ControllerName}/BioRad/attachment", GetStringContent());
|
||||
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user