< Summary

Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 2562
Line coverage: 100%
Branch coverage
100%
Covered branches: 8
Total branches: 8
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
File 1: Shape()100%11100%
File 2: Normalize(...)100%22100%
File 2: IsValid(...)100%66100%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/obj/Release/net8.0/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs

File '/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/obj/Release/net8.0/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs' does not exist (any more).

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/PartnerServices/PartnerEmail.cs

#LineLine coverage
 1using System.Net.Mail;
 2using System.Text.RegularExpressions;
 3
 4namespace Services.PartnerServices;
 5
 6/// <summary>Почта партнёра: нормализация и проверка. Правила зеркалят проверку на странице входа PartnerOffice.</summar
 7public static partial class PartnerEmail
 8{
 9    public const int MaxLength = 320;
 10
 11    [GeneratedRegex(@"^[^@\s]+@[^@\s]+\.[^@\s]{2,}$")]
 12    private static partial Regex Shape();
 13
 9414    public static string Normalize(string? email) => (email ?? string.Empty).Trim().ToLowerInvariant();
 15
 16    /// <summary>Ждёт уже нормализованное значение.</summary>
 17    public static bool IsValid(string email) =>
 9018        email.Length <= MaxLength && Shape().IsMatch(email) && MailAddress.TryCreate(email, out var parsed) && parsed.Ad
 19}