< Summary - Core.Tests

Information
Class: Common.Core.Models.Province
Assembly: Common.Core
File(s): D:\a\NuGetPackages\NuGetPackages\src\Common\Core\Models\Province.cs
Tag: 3_8508158812
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 37
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

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Id()100%11100%
get_Code()100%11100%
get_Name()100%11100%
Read(...)100%11100%

File(s)

D:\a\NuGetPackages\NuGetPackages\src\Common\Core\Models\Province.cs

#LineLine coverage
 1using System.ComponentModel.DataAnnotations;
 2using System.Data;
 3using System.Text.Json.Serialization;
 4using Common.Core.Classes;
 5
 6namespace Common.Core.Models;
 7
 8/// <summary>Province details.</summary>
 9public class Province : ModelData
 10{
 11  /// <inheritdoc/>
 112  public override int Id { get; set; }
 13
 14  /// <summary>Province code.</summary>
 15  [MaxLength( 10 )]
 16  [JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
 3217  public string? Code { get; set; }
 18
 19  /// <summary>Province name.</summary>
 20  [Required]
 21  [MaxLength( 50 )]
 5122  public string Name { get; set; } = string.Empty;
 23
 24  /// <summary>Builds a Province object from a database table row.</summary>
 25  /// <param name="row">Database row containing the Province columns.</param>
 26  /// <returns>Province object containing the database values.</returns>
 27  /// <remarks>This method assumes that the table column names are the same as the property names.</remarks>
 28  public static Province Read( DataRow row )
 129  {
 130    return new Province()
 131    {
 132      Id = row.Field<int>( nameof( Id ) ),
 133      Code = row.Field<string?>( nameof( Code ) ),
 134      Name = row.Field<string>( nameof( Name ) )!
 135    };
 136  }
 37}