mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add tests for Machine, implement IEquatable for Machine
This commit is contained in:
@@ -11,7 +11,7 @@ namespace SabreTools.DatItems
|
||||
/// Represents the information specific to a set/game/machine
|
||||
/// </summary>
|
||||
[JsonObject("machine"), XmlRoot("machine")]
|
||||
public sealed class Machine : ModelBackedItem<Models.Metadata.Machine>, ICloneable
|
||||
public sealed class Machine : ModelBackedItem<Models.Metadata.Machine>, ICloneable, IEquatable<Machine>
|
||||
{
|
||||
#region Constants
|
||||
|
||||
@@ -57,15 +57,6 @@ namespace SabreTools.DatItems
|
||||
|
||||
#endregion
|
||||
|
||||
#region Accessors
|
||||
|
||||
/// <summary>
|
||||
/// Get a clone of the current internal model
|
||||
/// </summary>
|
||||
public Models.Metadata.Machine GetInternalClone() => (_internal.Clone() as Models.Metadata.Machine)!;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Cloning methods
|
||||
|
||||
/// <summary>
|
||||
@@ -76,10 +67,15 @@ namespace SabreTools.DatItems
|
||||
{
|
||||
return new Machine()
|
||||
{
|
||||
_internal = this._internal.Clone() as Models.Metadata.Machine ?? [],
|
||||
_internal = _internal.Clone() as Models.Metadata.Machine ?? [],
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a clone of the current internal model
|
||||
/// </summary>
|
||||
public Models.Metadata.Machine GetInternalClone() => (_internal.Clone() as Models.Metadata.Machine)!;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Comparision Methods
|
||||
@@ -114,6 +110,17 @@ namespace SabreTools.DatItems
|
||||
return _internal.EqualTo(otherItem._internal);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals(Machine? other)
|
||||
{
|
||||
// If other is null
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
// Compare internal models
|
||||
return _internal.EqualTo(other._internal);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Manipulation
|
||||
|
||||
Reference in New Issue
Block a user