< Summary - MechanicsSoftware — Coverage Report

Information
Class: MechanicsSoftware.Infrastructure.Persistence.Configurations.UserConfiguration
Assembly: MechanicsSoftware.Infrastructure
File(s): /home/runner/work/mechanics-software/mechanics-software/src/MechanicsSoftware.Infrastructure/Persistence/Configurations/UserConfiguration.cs
Line coverage
100%
Covered lines: 35
Uncovered lines: 0
Coverable lines: 35
Total lines: 46
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Configure(...)100%11100%
Configure(...)100%11100%

File(s)

/home/runner/work/mechanics-software/mechanics-software/src/MechanicsSoftware.Infrastructure/Persistence/Configurations/UserConfiguration.cs

#LineLine coverage
 1using Microsoft.EntityFrameworkCore;
 2using Microsoft.EntityFrameworkCore.Metadata.Builders;
 3using MechanicsSoftware.Domain.Entities;
 4using MechanicsSoftware.Domain.ValueObjects;
 5using MechanicsSoftware.Domain.Enums;
 6using MechanicsSoftware.Domain.Exceptions;
 7
 8namespace MechanicsSoftware.Infrastructure.Persistence.Configurations;
 9
 10internal sealed class UserConfiguration : IEntityTypeConfiguration<User>
 111{
 112    public void Configure(EntityTypeBuilder<User> builder)
 213    {
 314        builder.ToTable("users");
 115
 216        builder.HasKey(u => u.Id);
 317        builder.Property(u => u.Id).HasColumnName("id");
 118
 319        builder.Property(u => u.Name)
 320            .HasColumnName("name")
 221            .HasMaxLength(100)
 322            .IsRequired();
 123
 324        builder.Property(u => u.Email)
 325            .HasConversion(
 326                v => v.Value,
 327                v => new Email(v))
 328            .HasColumnName("email")
 229            .HasMaxLength(256)
 330            .IsRequired();
 131
 332        builder.HasIndex(u => u.Email)
 233            .IsUnique()
 334            .HasDatabaseName("ix_users_email");
 135
 336        builder.Property(u => u.PasswordHash)
 337            .HasColumnName("password_hash")
 238            .HasMaxLength(60) // BCrypt.Net-Next always produces 60-char hashes
 339            .IsRequired();
 140
 341        builder.Property(u => u.Role)
 342            .HasColumnName("role")
 343            .HasMaxLength(20)
 244            .IsRequired();
 245    }
 46}