mirror of
https://github.com/alex289/CleanArchitecture.git
synced 2025-06-29 18:21:08 +00:00
43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using CleanArchitecture.Application.Queries.Users.GetAll;
|
|
using CleanArchitecture.Application.Tests.Fixtures.Queries.Users;
|
|
using FluentAssertions;
|
|
using Xunit;
|
|
|
|
namespace CleanArchitecture.Application.Tests.Queries.Users;
|
|
|
|
public sealed class GetAllUsersQueryHandlerTests
|
|
{
|
|
private readonly GetAllUsersTestFixture _fixture = new();
|
|
|
|
[Fact]
|
|
public async Task Should_Get_All_Users()
|
|
{
|
|
_fixture.SetupUserAsync();
|
|
|
|
var result = await _fixture.Handler.Handle(
|
|
new GetAllUsersQuery(),
|
|
default);
|
|
|
|
_fixture.VerifyNoDomainNotification();
|
|
|
|
result.Should().NotBeNull();
|
|
result.Should().ContainSingle();
|
|
result.FirstOrDefault()!.Id.Should().Be(_fixture.ExistingUserId);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Should_Not_Get_Deleted_Users()
|
|
{
|
|
_fixture.SetupDeletedUserAsync();
|
|
|
|
var result = await _fixture.Handler.Handle(
|
|
new GetAllUsersQuery(),
|
|
default);
|
|
|
|
_fixture.VerifyNoDomainNotification();
|
|
|
|
result.Should().BeEmpty();
|
|
}
|
|
} |