< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.WebApi.Email.MailgunRegistrationAttemptSender
Assembly: ArturRios.Heimdall.WebApi
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Presentation/ArturRios.Heimdall.WebApi/Email/MailgunRegistrationAttemptSender.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 13
Coverable lines: 13
Total lines: 35
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage
0%
Covered methods: 0
Fully covered methods: 0
Total methods: 3
Method coverage: 0%
Full method coverage: 0%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
get_Purpose()100%210%
SendAsync(...)0%620%

File(s)

/home/runner/work/heimdall-api/heimdall-api/src/Presentation/ArturRios.Heimdall.WebApi/Email/MailgunRegistrationAttemptSender.cs

#LineLine coverage
 1using ArturRios.Heimdall.Command.Services;
 2using ArturRios.Messaging.Email;
 3
 4namespace ArturRios.Heimdall.WebApi.Email;
 5
 6/// <summary>
 7///     Delivers UC-47's registration-attempt notice through Mailgun (AF-47b). A failure is logged by
 8///     <see cref="MailgunSender" /> and never propagated.
 9/// </summary>
 10public class MailgunRegistrationAttemptSender(
 11    IEmailService emailService,
 12    ILogger<MailgunRegistrationAttemptSender> logger)
 013    : MailgunSender(emailService, logger), IRegistrationAttemptSender
 14{
 15    private const string Subject = "Someone tried to create an account with your address";
 16
 017    protected override string Purpose => "registration attempt";
 18
 19    public Task SendAsync(string email, bool googleAccount)
 20    {
 021        var instead = googleAccount
 022            ? "Your account signs in with Google. Use \"Continue with Google\" to sign in."
 023            : "Sign in with your password, or use \"Forgotten your password?\" if you no longer have it.";
 24
 025        var body = $"""
 026                    Someone tried to create a new account with this address. You already have one.
 027
 028                    If it was you: {instead}
 029
 030                    If it was not you, you do not need to do anything. Nothing about your account has changed.
 031                    """;
 32
 033        return DeliverAsync(email, Subject, body);
 34    }
 35}