code style cleanup

This commit is contained in:
Aaron Po
2026-06-20 13:55:17 -04:00
parent 07aedcb866
commit 254431928f
167 changed files with 3711 additions and 3522 deletions

View File

@@ -1,7 +1,7 @@
using Domain.Entities;
using FluentAssertions;
using Features.UserManagement.Queries.GetAllUsers;
using Features.UserManagement.Repository;
using FluentAssertions;
using Moq;
namespace Features.UserManagement.Tests.Queries;
@@ -11,13 +11,13 @@ public class GetAllUsersHandlerTests
[Fact]
public async Task Handle_PassesLimitAndOffset_ToRepository()
{
var repoMock = new Mock<IUserAccountRepository>();
var handler = new GetAllUsersHandler(repoMock.Object);
Mock<IUserAccountRepository> repoMock = new();
GetAllUsersHandler handler = new(repoMock.Object);
repoMock.Setup(r => r.GetAllAsync(10, 5)).ReturnsAsync(Array.Empty<UserAccount>());
var result = await handler.Handle(new GetAllUsersQuery(10, 5), CancellationToken.None);
IEnumerable<UserAccount> result = await handler.Handle(new GetAllUsersQuery(10, 5), CancellationToken.None);
result.Should().BeEmpty();
repoMock.Verify(r => r.GetAllAsync(10, 5), Times.Once);
}
}
}

View File

@@ -1,16 +1,16 @@
using Domain.Entities;
using Domain.Exceptions;
using FluentAssertions;
using Features.UserManagement.Queries.GetUserById;
using Features.UserManagement.Repository;
using FluentAssertions;
using Moq;
namespace Features.UserManagement.Tests.Queries;
public class GetUserByIdHandlerTests
{
private readonly Mock<IUserAccountRepository> _repoMock = new();
private readonly GetUserByIdHandler _handler;
private readonly Mock<IUserAccountRepository> _repoMock = new();
public GetUserByIdHandlerTests()
{
@@ -20,10 +20,10 @@ public class GetUserByIdHandlerTests
[Fact]
public async Task Handle_ReturnsUser_WhenFound()
{
var user = new UserAccount { UserAccountId = Guid.NewGuid(), Username = "test" };
UserAccount user = new() { UserAccountId = Guid.NewGuid(), Username = "test" };
_repoMock.Setup(r => r.GetByIdAsync(user.UserAccountId)).ReturnsAsync(user);
var result = await _handler.Handle(new GetUserByIdQuery(user.UserAccountId), CancellationToken.None);
UserAccount result = await _handler.Handle(new GetUserByIdQuery(user.UserAccountId), CancellationToken.None);
result.Should().Be(user);
}
@@ -31,11 +31,11 @@ public class GetUserByIdHandlerTests
[Fact]
public async Task Handle_Throws_WhenNotFound()
{
var id = Guid.NewGuid();
Guid id = Guid.NewGuid();
_repoMock.Setup(r => r.GetByIdAsync(id)).ReturnsAsync((UserAccount?)null);
var act = async () => await _handler.Handle(new GetUserByIdQuery(id), CancellationToken.None);
Func<Task<UserAccount>> act = async () => await _handler.Handle(new GetUserByIdQuery(id), CancellationToken.None);
await act.Should().ThrowAsync<NotFoundException>();
}
}
}