< Summary

Information
Class: DotNetApiDiff.Models.ComparisonResult
Assembly: DotNetApiDiff
File(s): /home/runner/work/dotnet-api-diff/dotnet-api-diff/src/DotNetApiDiff/Models/ComparisonResult.cs
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 81
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
get_OldAssemblyPath()100%11100%
get_NewAssemblyPath()100%11100%
get_ComparisonTimestamp()100%11100%
get_Differences()100%11100%
get_Summary()100%11100%
get_Configuration()100%11100%
get_HasBreakingChanges()100%11100%
get_TotalDifferences()100%11100%

File(s)

/home/runner/work/dotnet-api-diff/dotnet-api-diff/src/DotNetApiDiff/Models/ComparisonResult.cs

#LineLine coverage
 1// Copyright DotNet API Diff Project Contributors - SPDX Identifier: MIT
 2using DotNetApiDiff.Models.Configuration;
 3
 4namespace DotNetApiDiff.Models;
 5
 6/// <summary>
 7/// Represents the result of comparing two assemblies
 8/// </summary>
 9public class ComparisonResult
 10{
 11    /// <summary>
 12    /// Path to the original assembly
 13    /// </summary>
 9614    public string OldAssemblyPath { get; set; } = string.Empty;
 15
 16    /// <summary>
 17    /// Path to the new assembly
 18    /// </summary>
 9619    public string NewAssemblyPath { get; set; } = string.Empty;
 20
 21    /// <summary>
 22    /// Timestamp when the comparison was performed
 23    /// </summary>
 7624    public DateTime ComparisonTimestamp { get; set; } = DateTime.UtcNow;
 25
 26    /// <summary>
 27    /// List of all detected API differences
 28    /// </summary>
 30329    public List<ApiDifference> Differences { get; set; } = new List<ApiDifference>();
 30
 31    /// <summary>
 32    /// Summary statistics of the comparison
 33    /// </summary>
 19034    public ComparisonSummary Summary { get; set; } = new ComparisonSummary();
 35
 36    /// <summary>
 37    /// Configuration used for the comparison
 38    /// </summary>
 5139    public ComparisonConfiguration Configuration { get; set; } = ComparisonConfiguration.CreateDefault();
 40
 41    /// <summary>
 42    /// Gets whether any breaking changes were detected
 43    /// </summary>
 9244    public bool HasBreakingChanges => Differences.Any(d => d.IsBreakingChange);
 45
 46    /// <summary>
 47    /// Gets the total number of differences found
 48    /// </summary>
 2949    public int TotalDifferences => Differences.Count;
 50}
 51
 52/// <summary>
 53/// Summary statistics for a comparison result
 54/// </summary>
 55public class ComparisonSummary
 56{
 57    /// <summary>
 58    /// Number of added API elements
 59    /// </summary>
 60    public int AddedCount { get; set; }
 61
 62    /// <summary>
 63    /// Number of removed API elements
 64    /// </summary>
 65    public int RemovedCount { get; set; }
 66
 67    /// <summary>
 68    /// Number of modified API elements
 69    /// </summary>
 70    public int ModifiedCount { get; set; }
 71
 72    /// <summary>
 73    /// Number of breaking changes
 74    /// </summary>
 75    public int BreakingChangesCount { get; set; }
 76
 77    /// <summary>
 78    /// Total number of changes
 79    /// </summary>
 80    public int TotalChanges => AddedCount + RemovedCount + ModifiedCount;
 81}