< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.WebApi.Email.MailgunTwoFactorEmailSender
Assembly: ArturRios.Heimdall.WebApi
File(s): /home/ci/agent/workspace/heimdall-api-docs_main/app/src/Presentation/ArturRios.Heimdall.WebApi/Email/MailgunTwoFactorEmailSender.cs
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 30
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 3
Fully covered methods: 3
Total methods: 3
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Purpose()100%11100%
SendAsync(...)100%11100%

File(s)

/home/ci/agent/workspace/heimdall-api-docs_main/app/src/Presentation/ArturRios.Heimdall.WebApi/Email/MailgunTwoFactorEmailSender.cs

#LineLine coverage
 1using ArturRios.Heimdall.Command.Services;
 2using ArturRios.Messaging.Email;
 3
 4namespace ArturRios.Heimdall.WebApi.Email;
 5
 6/// <summary>
 7///     Delivers UC-36's two-factor email code as a real email through Mailgun (FR-2F-03). Registered
 8///     in place of <see cref="LoggingTwoFactorEmailSender" /> whenever Mailgun is configured.
 9/// </summary>
 10public class MailgunTwoFactorEmailSender(
 11    IEmailService emailService,
 12    ILogger<MailgunTwoFactorEmailSender> logger)
 413    : MailgunSender(emailService, logger), ITwoFactorEmailSender
 14{
 15    private const string Subject = "Your two-factor authentication code";
 16
 417    protected override string Purpose => "two-factor authentication code";
 18
 19    public Task SendAsync(string email, string code)
 20    {
 421        var body = $"""
 422                    Your two-factor authentication code is: {code}
 423
 424                    This code expires in 10 minutes. If you didn't request this, you can ignore this
 425                    email — nothing has changed.
 426                    """;
 27
 428        return DeliverAsync(email, Subject, body);
 29    }
 30}