| | | 1 | | // Copyright DotNet API Diff Project Contributors - SPDX Identifier: MIT |
| | | 2 | | using DotNetApiDiff.Models.Configuration; |
| | | 3 | | |
| | | 4 | | namespace DotNetApiDiff.Models; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Represents the result of comparing two assemblies |
| | | 8 | | /// </summary> |
| | | 9 | | public class ComparisonResult |
| | | 10 | | { |
| | | 11 | | /// <summary> |
| | | 12 | | /// Path to the original assembly |
| | | 13 | | /// </summary> |
| | 96 | 14 | | public string OldAssemblyPath { get; set; } = string.Empty; |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// Path to the new assembly |
| | | 18 | | /// </summary> |
| | 96 | 19 | | public string NewAssemblyPath { get; set; } = string.Empty; |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// Timestamp when the comparison was performed |
| | | 23 | | /// </summary> |
| | 76 | 24 | | public DateTime ComparisonTimestamp { get; set; } = DateTime.UtcNow; |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// List of all detected API differences |
| | | 28 | | /// </summary> |
| | 303 | 29 | | public List<ApiDifference> Differences { get; set; } = new List<ApiDifference>(); |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// Summary statistics of the comparison |
| | | 33 | | /// </summary> |
| | 190 | 34 | | public ComparisonSummary Summary { get; set; } = new ComparisonSummary(); |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Configuration used for the comparison |
| | | 38 | | /// </summary> |
| | 51 | 39 | | public ComparisonConfiguration Configuration { get; set; } = ComparisonConfiguration.CreateDefault(); |
| | | 40 | | |
| | | 41 | | /// <summary> |
| | | 42 | | /// Gets whether any breaking changes were detected |
| | | 43 | | /// </summary> |
| | 92 | 44 | | public bool HasBreakingChanges => Differences.Any(d => d.IsBreakingChange); |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Gets the total number of differences found |
| | | 48 | | /// </summary> |
| | 29 | 49 | | public int TotalDifferences => Differences.Count; |
| | | 50 | | } |
| | | 51 | | |
| | | 52 | | /// <summary> |
| | | 53 | | /// Summary statistics for a comparison result |
| | | 54 | | /// </summary> |
| | | 55 | | public 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 | | } |