Characterization Data
FI Backlog with Ignore Tag
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OI.Metrology.Shared.Models;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
|
||||
namespace OI.Metrology.Tests;
|
||||
@ -14,7 +15,7 @@ public class UnitTestFileShareController
|
||||
private static ILogger? _Logger;
|
||||
private static string _ControllerName;
|
||||
private static TestContext _TestContext;
|
||||
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||
private static WebApplicationFactory<Wafer.Counter.Program>? _WebApplicationFactory;
|
||||
|
||||
#pragma warning restore
|
||||
|
||||
@ -22,10 +23,11 @@ public class UnitTestFileShareController
|
||||
public static void ClassInitAsync(TestContext testContext)
|
||||
{
|
||||
_TestContext = testContext;
|
||||
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||
_WebApplicationFactory = new WebApplicationFactory<Wafer.Counter.Program>();
|
||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||
_ControllerName = nameof(Server.ApiControllers.FileShareController)[..^10];
|
||||
_Logger = serviceProvider.GetRequiredService<ILogger<Wafer.Counter.Program>>();
|
||||
// _ControllerName = nameof(Server.ApiControllers.FileShareController)[..^10];
|
||||
_ControllerName = nameof(Wafer.Counter.ApiControllers.FileShareController)[..^10];
|
||||
}
|
||||
|
||||
private static void NonThrowTryCatch()
|
||||
@ -82,4 +84,37 @@ public class UnitTestFileShareController
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetArchiveData()
|
||||
{
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
List<CharacterizationInfo>? result;
|
||||
CharacterizationParameters characterizationParameters;
|
||||
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||
IFileShareRepository? fileShareRepository = serviceProvider?.GetRequiredService<IFileShareRepository>();
|
||||
characterizationParameters = new("FQA", "FQA-8INCH", "*.wc", null, null, "8INCH");
|
||||
result = fileShareRepository?.GetArchiveData(characterizationParameters);
|
||||
Assert.IsNotNull(result);
|
||||
characterizationParameters = new(string.Empty, "BIORAD4", "BIO*.json", null, null, "8INCH");
|
||||
result = fileShareRepository?.GetArchiveData(characterizationParameters);
|
||||
Assert.IsNotNull(result);
|
||||
characterizationParameters = new(string.Empty, "CDE5", "CDE*.json", null, null, "8INCH");
|
||||
result = fileShareRepository?.GetArchiveData(characterizationParameters);
|
||||
Assert.IsNotNull(result);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ArchiveDataApi()
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
string? response = await httpClient.GetStringAsync($"api/v1/file-share/archive-data/?area=FQA&equipment-id=FQA-8INCH&search-pattern=*.wc&wafer-size=8INCH");
|
||||
Assert.IsNotNull(response);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user