< Summary - MechanicsSoftware — Coverage Report

Information
Class: MechanicsSoftware.Infrastructure.Persistence.Configurations.VehicleConfiguration
Assembly: MechanicsSoftware.Infrastructure
File(s): /home/runner/work/mechanics-software/mechanics-software/src/MechanicsSoftware.Infrastructure/Persistence/Configurations/VehicleConfiguration.cs
Line coverage
100%
Covered lines: 46
Uncovered lines: 0
Coverable lines: 46
Total lines: 57
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/VehicleConfiguration.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 VehicleConfiguration : IEntityTypeConfiguration<Vehicle>
 111{
 112    public void Configure(EntityTypeBuilder<Vehicle> builder)
 213    {
 314        builder.ToTable("vehicles");
 115
 216        builder.HasKey(v => v.Id);
 317        builder.Property(v => v.Id).HasColumnName("id");
 118
 319        builder.Property(v => v.LicensePlate)
 320            .HasConversion(
 321                v => v.Value,
 322                v => new LicensePlate(v))
 323            .HasColumnName("license_plate")
 224            .HasMaxLength(10)
 325            .IsRequired();
 126
 327        builder.Property(v => v.Make)
 328            .HasColumnName("make")
 229            .HasMaxLength(50)
 330            .IsRequired();
 131
 332        builder.Property(v => v.Model)
 333            .HasColumnName("model")
 234            .HasMaxLength(50)
 335            .IsRequired();
 136
 337        builder.Property(v => v.Year)
 238            .HasColumnName("year")
 339            .IsRequired();
 140
 341        builder.Property(v => v.CustomerId)
 242            .HasColumnName("customer_id")
 343            .IsRequired();
 144
 345        builder.HasIndex(v => v.LicensePlate)
 246            .IsUnique()
 347            .HasDatabaseName("ix_vehicles_license_plate");
 148
 249        builder.HasIndex(v => v.CustomerId)
 350            .HasDatabaseName("ix_vehicles_customer_id");
 151
 352        builder.HasOne<Customer>()
 353            .WithMany()
 354            .HasForeignKey(v => v.CustomerId)
 255            .OnDelete(DeleteBehavior.Restrict);
 256    }
 57}