< Summary - Core.Tests

Information
Class: Common.Core.Classes.ResultsSet<T>
Assembly: Common.Core
File(s): D:\a\NuGetPackages\NuGetPackages\src\Common\Core\Classes\ResultsSet.cs
Tag: 3_8508158812
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 42
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
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_Total()100%11100%
get_Previous()100%11100%
get_Next()100%11100%
get_Results()100%11100%
get_Max()100%11100%
.ctor()100%11100%
.ctor(...)100%44100%

File(s)

D:\a\NuGetPackages\NuGetPackages\src\Common\Core\Classes\ResultsSet.cs

#LineLine coverage
 1using System.Text.Json.Serialization;
 2
 3namespace Common.Core.Classes;
 4
 5/// <summary>Class that contains the properties of a data result set.</summary>
 6/// <typeparam name="T">Generic class or interface.</typeparam>
 7public class ResultsSet<T> where T : class
 8{
 9  /// <summary>Gets or sets the total count of the results.</summary>
 10  [JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
 111  public int? Total { get; set; }
 12
 13  /// <summary>Gets or sets the previous start position.</summary>
 14  [JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
 115  public string? Previous { get; set; }
 16
 17  /// <summary>Gets or sets the next start position.</summary>
 18  [JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
 119  public string? Next { get; set; }
 20
 21  /// <summary>Gets or sets the results collection.</summary>
 722  public ICollection<T> Results { get; set; } = new List<T>();
 23
 24  /// <summary>Gets the maximum numbers of results to return.</summary>
 25  [JsonIgnore]
 626  public int Max { get; private set; } = 10;
 27
 28  #region Constructors
 29
 30  /// <summary>Default constructor for Json serialization.</summary>
 131  public ResultsSet()
 232  { }
 33
 34  /// <summary>Initializes a new instance of the ResultsSet class.</summary>
 35  /// <param name="max">Maximum numbers of results to return.</param>
 336  public ResultsSet( int? max = 0 )
 337  {
 638    if( max is not null and > 0 ) { Max = max.Value; }
 339  }
 40
 41  #endregion
 42}