diff --git a/sources/Server.Presentation.Grpc.IntegrationTests/Services/AccountServices/ResendConfirmationEmailTests.cs b/sources/Server.Presentation.Grpc.IntegrationTests/Services/AccountServices/ResendConfirmationEmailTests.cs new file mode 100644 index 0000000..3353153 --- /dev/null +++ b/sources/Server.Presentation.Grpc.IntegrationTests/Services/AccountServices/ResendConfirmationEmailTests.cs @@ -0,0 +1,59 @@ +using MadWorldNL.Server.Infrastructure.Database.Users; +using MadWorldNL.Server.Presentation.Grpc.IntegrationTests.TestBase; +using Microsoft.AspNetCore.Identity; +using Microsoft.Extensions.DependencyInjection; +using Server.Presentation.Grpc.Account.V1; +using Shouldly; + +namespace MadWorldNL.Server.Presentation.Grpc.IntegrationTests.Services.AccountServices; + +[Collection(Collections.Applcation)] +public class ResendConfirmationEmailTests : IAsyncLifetime +{ + private readonly GrpcFactory _factory; + + public ResendConfirmationEmailTests(GrpcFactory factory) + { + _factory = factory; + } + + [Fact] + public async Task ResendConfirmationEmail_GivenExistingEmail_ReturnsOK() + { + // Arrange + const string email = "test@test.nl"; + + using (var scope = _factory.CreateScope()) + { + var userManager = scope.ServiceProvider.GetRequiredService>(); + + var user = new IdentityUserExtended() + { + UserName = email, + Email = email + }; + + await userManager.CreateAsync(user); + } + + var request = new ResendConfirmationEmailRequest() + { + Email = email + }; + + var client = new Account.AccountClient(_factory.Channel); + + // Act + var response = client.ResendConfirmationEmail(request); + + // Assert + response.IsSuccess.ShouldBeTrue(); + response.Message.ShouldNotBeNullOrEmpty(); + } + + public Task InitializeAsync() => Task.CompletedTask; + public Task DisposeAsync() + { + return _factory.ResetDatabase(); + } +} \ No newline at end of file