Add DatStatistics constructor tests

This commit is contained in:
Matt Nadareski
2025-02-12 11:03:25 -05:00
parent bc1725656b
commit a66320fb74

View File

@@ -10,7 +10,25 @@ namespace SabreTools.DatFiles.Test
{ {
#region Constructor #region Constructor
// TODO: Write Constructor tests [Fact]
public void DefaultConstructorTest()
{
var stats = new DatStatistics();
Assert.Null(stats.DisplayName);
Assert.Equal(0, stats.MachineCount);
Assert.False(stats.IsDirectory);
}
[Fact]
public void NamedConstructorTest()
{
var stats = new DatStatistics("name", isDirectory: true);
Assert.Equal("name", stats.DisplayName);
Assert.Equal(0, stats.MachineCount);
Assert.True(stats.IsDirectory);
}
#endregion #endregion
@@ -69,7 +87,7 @@ namespace SabreTools.DatFiles.Test
Assert.Equal(1, stats.GetItemCount(ItemType.Rom)); Assert.Equal(1, stats.GetItemCount(ItemType.Rom));
Assert.Equal(1, stats.GetItemCount(ItemType.Sample)); Assert.Equal(1, stats.GetItemCount(ItemType.Sample));
Assert.Equal(2, stats.GetStatusCount(ItemStatus.Good)); Assert.Equal(2, stats.GetStatusCount(ItemStatus.Good));
// RemoveItemStatistics // RemoveItemStatistics
stats.RemoveItemStatistics(disk); stats.RemoveItemStatistics(disk);
stats.RemoveItemStatistics(file); stats.RemoveItemStatistics(file);
@@ -148,7 +166,7 @@ namespace SabreTools.DatFiles.Test
Assert.Equal(1, stats.GetItemCount(ItemType.Rom)); Assert.Equal(1, stats.GetItemCount(ItemType.Rom));
Assert.Equal(1, stats.GetItemCount(ItemType.Sample)); Assert.Equal(1, stats.GetItemCount(ItemType.Sample));
Assert.Equal(2, stats.GetStatusCount(ItemStatus.Good)); Assert.Equal(2, stats.GetStatusCount(ItemStatus.Good));
// ResetStatistics // ResetStatistics
stats.ResetStatistics(); stats.ResetStatistics();