mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Start adding DatItem tests
This commit is contained in:
@@ -1,22 +1,50 @@
|
|||||||
using SabreTools.DatItems;
|
|
||||||
using SabreTools.DatItems.Formats;
|
using SabreTools.DatItems.Formats;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace SabreTools.Test.DatItems
|
namespace SabreTools.DatItems.Test
|
||||||
{
|
{
|
||||||
public class DatItemTests
|
public class DatItemTests
|
||||||
{
|
{
|
||||||
|
#region CopyMachineInformation
|
||||||
|
|
||||||
|
// TODO: Implement CopyMachineInformation tests
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region CompareTo
|
||||||
|
|
||||||
|
// TODO: Implement CompareTo tests
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Equals
|
||||||
|
|
||||||
|
// TODO: Implement Equals tests
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region GetDuplicateStatus
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void DuplicateStatusUnequalTest()
|
public void GetDuplicateStatus_NullOther_NoDupe()
|
||||||
{
|
{
|
||||||
var rom = new Rom();
|
DatItem item = new Rom();
|
||||||
var disk = new Disk();
|
DatItem? lastItem = null;
|
||||||
var actual = rom.GetDuplicateStatus(disk);
|
var actual = item.GetDuplicateStatus(lastItem);
|
||||||
Assert.Equal((DupeType)0x00, actual);
|
Assert.Equal((DupeType)0x00, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void DuplicateStatusExternalAllTest()
|
public void GetDuplicateStatus_DifferentTypes_NoDupe()
|
||||||
|
{
|
||||||
|
var rom = new Rom();
|
||||||
|
DatItem? lastItem = new Disk();
|
||||||
|
var actual = rom.GetDuplicateStatus(lastItem);
|
||||||
|
Assert.Equal((DupeType)0x00, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void GetDuplicateStatus_DifferentSource_NameMatch_ExternalAll()
|
||||||
{
|
{
|
||||||
var machineA = new Machine();
|
var machineA = new Machine();
|
||||||
machineA.SetFieldValue<string?>(Models.Metadata.Machine.NameKey, "name-same");
|
machineA.SetFieldValue<string?>(Models.Metadata.Machine.NameKey, "name-same");
|
||||||
@@ -41,7 +69,7 @@ namespace SabreTools.Test.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void DuplicateStatusExternalHashTest()
|
public void GetDuplicateStatus_DifferentSource_NoNameMatch_ExternalHash()
|
||||||
{
|
{
|
||||||
var machineA = new Machine();
|
var machineA = new Machine();
|
||||||
machineA.SetFieldValue<string?>(Models.Metadata.Machine.NameKey, "name-same");
|
machineA.SetFieldValue<string?>(Models.Metadata.Machine.NameKey, "name-same");
|
||||||
@@ -66,7 +94,7 @@ namespace SabreTools.Test.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void DuplicateStatusInternalAllTest()
|
public void GetDuplicateStatus_SameSource_NameMatch_InternalAll()
|
||||||
{
|
{
|
||||||
var machineA = new Machine();
|
var machineA = new Machine();
|
||||||
machineA.SetFieldValue<string?>(Models.Metadata.Machine.NameKey, "name-same");
|
machineA.SetFieldValue<string?>(Models.Metadata.Machine.NameKey, "name-same");
|
||||||
@@ -91,7 +119,7 @@ namespace SabreTools.Test.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void DuplicateStatusInternalHashTest()
|
public void GetDuplicateStatus_SameSource_NoNameMatch_InternalHash()
|
||||||
{
|
{
|
||||||
var machineA = new Machine();
|
var machineA = new Machine();
|
||||||
machineA.SetFieldValue<string?>(Models.Metadata.Machine.NameKey, "name-same");
|
machineA.SetFieldValue<string?>(Models.Metadata.Machine.NameKey, "name-same");
|
||||||
@@ -115,8 +143,48 @@ namespace SabreTools.Test.DatItems
|
|||||||
Assert.Equal(DupeType.Internal | DupeType.Hash, actual);
|
Assert.Equal(DupeType.Internal | DupeType.Hash, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add tests for DatItem.Merge
|
#endregion
|
||||||
// TODO: Add tests for ResolveNames
|
|
||||||
// TODO: Add tests for Sort
|
#region GetDuplicateStatusDB
|
||||||
|
|
||||||
|
// TODO: Implement GetDuplicateStatusDB tests
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region PassesFilter
|
||||||
|
|
||||||
|
// TODO: Implement PassesFilter tests
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region GetKey
|
||||||
|
|
||||||
|
// TODO: Implement GetKey tests
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region GetName
|
||||||
|
|
||||||
|
// TODO: Implement GetName tests
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region SetName
|
||||||
|
|
||||||
|
// TODO: Implement SetName tests
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Clone
|
||||||
|
|
||||||
|
// TODO: Implement Clone tests
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region GetInternalClone
|
||||||
|
|
||||||
|
// TODO: Implement GetInternalClone tests
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -509,11 +509,6 @@ namespace SabreTools.DatItems
|
|||||||
SetFieldValue(NameKey, name);
|
SetFieldValue(NameKey, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get a clone of the current internal model
|
|
||||||
/// </summary>
|
|
||||||
public T GetInternalClone() => (_internal.Clone() as T)!;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Cloning Methods
|
#region Cloning Methods
|
||||||
@@ -532,6 +527,11 @@ namespace SabreTools.DatItems
|
|||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a clone of the current internal model
|
||||||
|
/// </summary>
|
||||||
|
public T GetInternalClone() => (_internal.Clone() as T)!;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
#region Comparision Methods
|
||||||
|
|||||||
Reference in New Issue
Block a user