< Summary

Information
Class: Pozitron.QuerySpecification.SpecificationBuilder<T>
Assembly: Pozitron.QuerySpecification
File(s): /home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification/Builders/SpecificationBuilder.cs
Tag: 67_15587897385
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 72
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 Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%11100%
Add(...)100%11100%
AddOrUpdate(...)100%11100%

File(s)

/home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification/Builders/SpecificationBuilder.cs

#LineLine coverage
 1namespace Pozitron.QuerySpecification;
 2
 3/// <summary>
 4/// Represents a specification builder that supports order operations.
 5/// </summary>
 6/// <typeparam name="T">The type of the entity.</typeparam>
 7/// <typeparam name="TResult">The type of the result.</typeparam>
 8public interface IOrderedSpecificationBuilder<T, TResult>
 9    : ISpecificationBuilder<T, TResult>, IOrderedSpecificationBuilder<T>
 10{
 11}
 12
 13/// <summary>
 14/// Represents a specification builder that supports order operations.
 15/// </summary>
 16/// <typeparam name="T">The type of the entity.</typeparam>
 17public interface IOrderedSpecificationBuilder<T>
 18    : ISpecificationBuilder<T>
 19{
 20}
 21
 22/// <summary>
 23/// Represents a specification builder.
 24/// </summary>
 25/// <typeparam name="T">The type of the entity.</typeparam>
 26/// <typeparam name="TResult">The type of the result.</typeparam>
 27public interface ISpecificationBuilder<T, TResult>
 28    : ISpecificationBuilder<T>
 29{
 30    new internal Specification<T, TResult> Specification { get; }
 31}
 32
 33/// <summary>
 34/// Represents a specification builder.
 35/// </summary>
 36/// <typeparam name="T">The type of the entity.</typeparam>
 37public interface ISpecificationBuilder<T>
 38{
 39    internal Specification<T> Specification { get; }
 40
 41    /// <summary>
 42    /// Adds an item to the specification.
 43    /// </summary>
 44    /// <param name="type">The type of the item.</param>
 45    /// <param name="value">The object to be stored in the item.</param>
 46    /// <exception cref="ArgumentNullException">Thrown if value is null</exception>
 47    /// <exception cref="ArgumentOutOfRangeException">Thrown if type is zero or negative.</exception>
 48    void Add(int type, object value);
 49
 50    /// <summary>
 51    /// Adds or updates an item in the specification.
 52    /// </summary>
 53    /// <param name="type">The type of the item.</param>
 54    /// <param name="value">The object to be stored in the item.</param>
 55    /// <exception cref="ArgumentNullException">Thrown if value is null</exception>
 56    /// <exception cref="ArgumentOutOfRangeException">Thrown if type is zero or negative.</exception>
 57    void AddOrUpdate(int type, object value);
 58}
 59
 60internal class SpecificationBuilder<T, TResult>(Specification<T, TResult> specification)
 61    : SpecificationBuilder<T>(specification), IOrderedSpecificationBuilder<T, TResult>, ISpecificationBuilder<T, TResult
 62{
 63    new public Specification<T, TResult> Specification { get; } = specification;
 64}
 65
 46266internal class SpecificationBuilder<T>(Specification<T> specification)
 67    : IOrderedSpecificationBuilder<T>, ISpecificationBuilder<T>
 68{
 109169    public Specification<T> Specification { get; } = specification;
 270    public void Add(int type, object value) => Specification.Add(type, value);
 271    public void AddOrUpdate(int type, object value) => Specification.AddOrUpdate(type, value);
 72}