Holy moly......

This commit is contained in:
lumijiez
2025-06-26 01:30:25 +03:00
parent 3cdfbf8954
commit a8ea4b41ee
34 changed files with 238 additions and 42 deletions

View File

@@ -15,7 +15,7 @@ public class CreateCategoryHandlerIntegrationTest : IDisposable
{
private readonly ApplicationDbContext _context;
private readonly IServiceProvider _serviceProvider;
private readonly CreateCategoryHandler _handler;
private readonly CreateCategory _handler;
private readonly SqliteConnection _connection;
public CreateCategoryHandlerIntegrationTest()
@@ -38,11 +38,11 @@ public class CreateCategoryHandlerIntegrationTest : IDisposable
services.AddScoped<IAddressRepository, AddressRepository>();
services.AddScoped<IUnitOfWork, UnitOfWork>();
services.AddScoped<CreateCategoryHandler>();
services.AddScoped<CreateCategory>();
_serviceProvider = services.BuildServiceProvider();
_context = _serviceProvider.GetRequiredService<ApplicationDbContext>();
_handler = _serviceProvider.GetRequiredService<CreateCategoryHandler>();
_handler = _serviceProvider.GetRequiredService<CreateCategory>();
_context.Database.EnsureCreated();
}
@@ -216,7 +216,7 @@ public class CreateCategoryHandlerIntegrationTest : IDisposable
var initialCount = await _context.Categories.CountAsync();
var handler = _serviceProvider.GetRequiredService<CreateCategoryHandler>();
var handler = _serviceProvider.GetRequiredService<CreateCategory>();
var result = await handler.Handle(command, CancellationToken.None);

View File

@@ -6,13 +6,13 @@ using Moq;
namespace Imprink.Application.Tests;
public class UpdateCategoryHandlerTests
public class UpdateCategoryTests
{
private readonly Mock<IUnitOfWork> _unitOfWorkMock;
private readonly Mock<ICategoryRepository> _categoryRepositoryMock;
private readonly UpdateCategoryHandler _handler;
private readonly UpdateCategory _handler;
public UpdateCategoryHandlerTests()
public UpdateCategoryTests()
{
_unitOfWorkMock = new Mock<IUnitOfWork>();
_categoryRepositoryMock = new Mock<ICategoryRepository>();
@@ -20,7 +20,7 @@ public class UpdateCategoryHandlerTests
_unitOfWorkMock.Setup(x => x.CategoryRepository)
.Returns(_categoryRepositoryMock.Object);
_handler = new UpdateCategoryHandler(_unitOfWorkMock.Object);
_handler = new UpdateCategory(_unitOfWorkMock.Object);
}
[Fact]