< Summary - MechanicsSoftware — Coverage Report

Information
Class: MechanicsSoftware.Infrastructure.Persistence.Configurations.ServiceConfiguration
Assembly: MechanicsSoftware.Infrastructure
File(s): /home/runner/work/mechanics-software/mechanics-software/src/MechanicsSoftware.Infrastructure/Persistence/Configurations/ServiceConfiguration.cs
Line coverage
100%
Covered lines: 32
Uncovered lines: 0
Coverable lines: 32
Total lines: 43
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/ServiceConfiguration.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
 10public sealed class ServiceConfiguration : IEntityTypeConfiguration<Service>
 111{
 112    public void Configure(EntityTypeBuilder<Service> builder)
 213    {
 314        builder.ToTable("services");
 115
 216        builder.HasKey(s => s.Id);
 317        builder.Property(s => s.Id).HasColumnName("id");
 118
 319        builder.Property(s => s.Name)
 320            .HasColumnName("name")
 221            .HasMaxLength(100)
 322            .IsRequired();
 123
 324        builder.Property(s => s.Description)
 225            .HasColumnName("description")
 326            .HasMaxLength(500);
 127
 328        builder.Property(s => s.BasePrice)
 329            .HasConversion(
 330                m => m.Cents,
 331                m => new Money(m))
 232            .HasColumnName("base_price")
 333            .IsRequired();
 134
 335        builder.Property(s => s.EstimatedMinutes)
 236            .HasColumnName("estimated_minutes")
 337            .IsRequired();
 138
 339        builder.HasIndex(s => s.Name)
 340            .IsUnique()
 241            .HasDatabaseName("ix_services_name");
 242    }
 43}