mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-07-16 17:47:22 +00:00
code style cleanup
This commit is contained in:
@@ -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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user