< Summary

Information
Class: Syki.Back.Features.Cross.CreatePendingUserRegister.CreatePendingUserRegisterService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Cross/CreatePendingUserRegister/CreatePendingUserRegisterService.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 23
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Create()100%44100%

File(s)

/home/runner/work/syki/syki/Back/Features/Cross/CreatePendingUserRegister/CreatePendingUserRegisterService.cs

#LineLine coverage
 1namespace Syki.Back.Features.Cross.CreatePendingUserRegister;
 2
 3133public class CreatePendingUserRegisterService(SykiDbContext ctx) : ICrossService
 4{
 5    public async Task<OneOf<SykiSuccess, SykiError>> Create(CreatePendingUserRegisterIn data)
 6    {
 3137        var email = data.Email.ToLower();
 8
 3139        var registerExists = await ctx.UserRegisters.AnyAsync(d => d.Email == email);
 31510        if (registerExists) return new EmailAlreadyUsed();
 11
 32812        if (!email.IsValidEmail()) return new InvalidEmail();
 13
 29414        var register = new UserRegister(email);
 29415        ctx.Add(register);
 16
 29417        ctx.Add(SykiTask.SendUserRegisterEmailConfirmation(email));
 18
 29419        await ctx.SaveChangesAsync();
 20
 29421        return new SykiSuccess();
 31322    }
 23}