< Summary - Core.Tests

Information
Class: Common.Core.Models.ISOCountry
Assembly: Common.Core
File(s): D:\a\NuGetPackages\NuGetPackages\src\Common\Core\Models\ISOCountry.cs
Tag: 3_8508158812
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 50
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_Alpha2()100%11100%
get_Alpha3()100%11100%
get_Name()100%11100%
Read(...)100%11100%

File(s)

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

#LineLine coverage
 1using System.ComponentModel.DataAnnotations;
 2using System.Data;
 3using Common.Core.Classes;
 4
 5namespace Common.Core.Models;
 6
 7/// <summary>ISO-3166 Country details.</summary>
 8public class ISOCountry : ModelData
 9{
 10  #region Properties
 11
 12  /// <inheritdoc/>
 113  public override int Id { get; set; }
 14
 15  /// <summary>2-digit ISO-3166 code.</summary>
 16  [Required]
 17  [MaxLength( 2 )]
 5618  public string Alpha2 { get; set; } = string.Empty;
 19
 20  /// <summary>3-digit ISO-3166 code.</summary>
 21  [Required]
 22  [MaxLength( 3 )]
 8023  public string Alpha3 { get; set; } = string.Empty;
 24
 25  /// <summary>Country name.</summary>
 26  [Required]
 27  [MaxLength( 50 )]
 11028  public string Name { get; set; } = string.Empty;
 29
 30  #endregion
 31
 32  #region Public Methods
 33
 34  /// <summary>Builds an ISOCountry object from a database table row.</summary>
 35  /// <param name="row">Database row containing the ISOCountry columns.</param>
 36  /// <returns>ISOCountry object containing the database values.</returns>
 37  /// <remarks>This method assumes that the table column names are the same as the property names.</remarks>
 38  public static ISOCountry Read( DataRow row )
 139  {
 140    return new ISOCountry()
 141    {
 142      Id = row.Field<int>( nameof( Id ) ),
 143      Alpha2 = row.Field<string>( nameof( Alpha2 ) )!,
 144      Alpha3 = row.Field<string>( nameof( Alpha3 ) )!,
 145      Name = row.Field<string>( nameof( Name ) )!
 146    };
 147  }
 48
 49  #endregion
 50}