mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-07-16 17:47:22 +00:00
70 lines
1.9 KiB
C#
70 lines
1.9 KiB
C#
using Features.Emails.Services;
|
|
|
|
namespace API.Specs.Mocks;
|
|
|
|
public class MockEmailDispatcher : IEmailDispatcher
|
|
{
|
|
public List<RegistrationEmail> SentRegistrationEmails { get; } = new();
|
|
|
|
public List<ResendConfirmationEmail> SentResendConfirmationEmails { get; } = new();
|
|
|
|
public Task SendRegistrationEmailAsync(
|
|
string firstName,
|
|
string email,
|
|
string confirmationToken
|
|
)
|
|
{
|
|
SentRegistrationEmails.Add(
|
|
new RegistrationEmail
|
|
{
|
|
FirstName = firstName,
|
|
Email = email,
|
|
ConfirmationToken = confirmationToken,
|
|
SentAt = DateTime.UtcNow
|
|
}
|
|
);
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
public Task SendResendConfirmationEmailAsync(
|
|
string firstName,
|
|
string email,
|
|
string confirmationToken
|
|
)
|
|
{
|
|
SentResendConfirmationEmails.Add(
|
|
new ResendConfirmationEmail
|
|
{
|
|
FirstName = firstName,
|
|
Email = email,
|
|
ConfirmationToken = confirmationToken,
|
|
SentAt = DateTime.UtcNow
|
|
}
|
|
);
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
SentRegistrationEmails.Clear();
|
|
SentResendConfirmationEmails.Clear();
|
|
}
|
|
|
|
public class RegistrationEmail
|
|
{
|
|
public string FirstName { get; init; } = string.Empty;
|
|
public string Email { get; init; } = string.Empty;
|
|
public string ConfirmationToken { get; init; } = string.Empty;
|
|
public DateTime SentAt { get; init; }
|
|
}
|
|
|
|
public class ResendConfirmationEmail
|
|
{
|
|
public string FirstName { get; init; } = string.Empty;
|
|
public string Email { get; init; } = string.Empty;
|
|
public string ConfirmationToken { get; init; } = string.Empty;
|
|
public DateTime SentAt { get; init; }
|
|
}
|
|
} |