mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-15 05:25:36 +08:00
35 lines
971 B
C#
35 lines
971 B
C#
using System.Threading.Tasks;
|
|
using BuildingBlocks.Contracts.EventBus.Messages;
|
|
using BuildingBlocks.TestBase.IntegrationTest;
|
|
using FluentAssertions;
|
|
using Identity.Api;
|
|
using Identity.Data;
|
|
using Integration.Test.Fakes;
|
|
using Xunit;
|
|
|
|
namespace Integration.Test.Identity.Features;
|
|
|
|
public class RegisterNewUserTests : IdentityIntegrationTestBase
|
|
{
|
|
public RegisterNewUserTests(
|
|
IntegrationTestFactory<Program, IdentityContext> integrationTestFactory) : base(integrationTestFactory)
|
|
{
|
|
}
|
|
|
|
[Fact]
|
|
public async Task should_create_new_user_to_db_and_publish_message_to_broker()
|
|
{
|
|
// Arrange
|
|
var command = new FakeRegisterNewUserCommand().Generate();
|
|
|
|
// Act
|
|
var response = await Fixture.SendAsync(command);
|
|
|
|
// Assert
|
|
response?.Should().NotBeNull();
|
|
response?.Username.Should().Be(command.Username);
|
|
|
|
(await Fixture.WaitForPublishing<UserCreated>()).Should().Be(true);
|
|
}
|
|
}
|