Handle nested item comparisons, add Equals tests

This commit is contained in:
Matt Nadareski
2025-01-08 11:36:43 -05:00
parent 8cf360a747
commit 5b430804d7
12 changed files with 501 additions and 4 deletions

View File

@@ -370,6 +370,40 @@ namespace SabreTools.DatFiles
#endregion
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? other)
{
// If other is null
if (other == null)
return false;
// If the type is mismatched
if (other is not DatHeader otherItem)
return false;
// Compare internal models
return _internal.EqualTo(otherItem._internal);
}
/// <inheritdoc/>
public override bool Equals(ModelBackedItem<Models.Metadata.Header>? other)
{
// If other is null
if (other == null)
return false;
// If the type is mismatched
if (other is not DatHeader otherItem)
return false;
// Compare internal models
return _internal.EqualTo(otherItem._internal);
}
#endregion
#region Manipulation
/// <summary>