2023-12-29 11:46:17 +05:00
|
|
|
using AsbCloudDb.Model;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
namespace AsbCloudWebApi.IntegrationTests;
|
|
|
|
|
2024-03-11 15:16:07 +05:00
|
|
|
public abstract class BaseIntegrationTest : IClassFixture<WebAppFactoryFixture>,
|
|
|
|
IDisposable
|
2023-12-29 11:46:17 +05:00
|
|
|
{
|
2024-01-25 15:56:34 +05:00
|
|
|
protected readonly IServiceScope scope;
|
2024-03-11 15:16:07 +05:00
|
|
|
|
|
|
|
protected readonly AsbCloudDbContext dbContext;
|
2023-12-29 11:46:17 +05:00
|
|
|
|
2024-01-23 16:19:30 +05:00
|
|
|
protected BaseIntegrationTest(WebAppFactoryFixture factory)
|
2023-12-29 11:46:17 +05:00
|
|
|
{
|
|
|
|
scope = factory.Services.CreateScope();
|
2024-03-11 15:16:07 +05:00
|
|
|
|
|
|
|
dbContext = scope.ServiceProvider.GetRequiredService<AsbCloudDbContext>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
scope.Dispose();
|
|
|
|
dbContext.Dispose();
|
2024-01-23 16:19:30 +05:00
|
|
|
}
|
2023-12-29 11:46:17 +05:00
|
|
|
}
|