This commit is contained in:
Zeeshaun
2026-03-13 09:11:35 -05:00
parent f004c8205a
commit c2d6bda458
197 changed files with 14970 additions and 0 deletions
@@ -0,0 +1,11 @@
namespace LCU.API.Internal.Document.PerformanceTest.API;
public static class ApiFactory
{
public static IDocumentApi Api => Environment.Type switch
{
EnvironmentType.Local => new DirectInMemoryDocumentApi(),
EnvironmentType.Azure => new DirectInMemoryDocumentApi(),
_ => throw new NotImplementedException()
};
}
@@ -0,0 +1,49 @@
using LCU.API.Internal.Document.Configurations;
using LCU.API.Internal.Document.Controllers;
using LCU.API.Internal.Document.PerformanceTest.DB;
using LCU.API.Internal.DocumentLib.Configurations;
using LCU.API.Internal.DocumentLib.DataAccess;
using LCU.Library.Internal.DocumentModels.Requests.Search;
using LCU.Library.Internal.DocumentModels.Responses;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Newtonsoft.Json;
namespace LCU.API.Internal.Document.PerformanceTest.API;
public class DirectInMemoryDocumentApi : IDocumentApi
{
private IServiceProvider? _services;
public Task SpinUp(DatabaseConfiguration databaseConfiguration)
{
if (_services is not null) return Task.CompletedTask;
var services = new ServiceCollection();
ServiceRegistrations.AddDocumentServices(services);
ServiceRegistrations.AddDocumentDataAccesses(services);
ServiceRegistrations.AddDocumentRepositories(services);
services.AddTransient<DocumentController>();
services.TryAddSingleton(databaseConfiguration);
services.AddSingleton<IBlobStorageClient, NullBlobStorageClient>();
services.AddSingleton<ApiConfiguration>();
services.AddSingleton<NotificationApiConfiguration>();
_services = services.BuildServiceProvider();
return Task.CompletedTask;
}
public async Task<IList<DocumentInformationResponse>> GetDocumentInformationByFilter(DocumentInformationFilter filter)
{
var controller = _services?.GetRequiredService<DocumentController>() ?? throw new InvalidOperationException();
var response = await controller.PostDocumentInformationByFilter(new DocumentInformationFilteredSearch{ Filter = filter });
return (response as OkObjectResult)?.Value as IList<DocumentInformationResponse> ?? throw new InvalidOperationException();
}
public Task TearDown()
{
return Task.CompletedTask;
}
}
@@ -0,0 +1,12 @@
using LCU.API.Internal.DocumentLib.Configurations;
using LCU.Library.Internal.DocumentModels.Requests.Search;
using LCU.Library.Internal.DocumentModels.Responses;
namespace LCU.API.Internal.Document.PerformanceTest.API;
public interface IDocumentApi
{
Task SpinUp(DatabaseConfiguration databaseConfiguration);
Task<IList<DocumentInformationResponse>> GetDocumentInformationByFilter(DocumentInformationFilter filter);
Task TearDown();
}