mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add DatHeader tests
This commit is contained in:
51
SabreTools.Test/DatFiles/DatHeaderTests.cs
Normal file
51
SabreTools.Test/DatFiles/DatHeaderTests.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using SabreTools.DatFiles;
|
||||
using Xunit;
|
||||
|
||||
namespace SabreTools.Test.DatFiles
|
||||
{
|
||||
public class DatHeaderTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(DatFormat.CSV, "csv")]
|
||||
[InlineData(DatFormat.ClrMamePro, "dat")]
|
||||
[InlineData(DatFormat.SabreJSON, "json")]
|
||||
[InlineData(DatFormat.AttractMode, "txt")]
|
||||
[InlineData(DatFormat.Logiqx, "xml")]
|
||||
public void CreateOutFileNamesTest(DatFormat datFormat, string extension)
|
||||
{
|
||||
// Create the empty DatHeader
|
||||
var datHeader = new DatHeader
|
||||
{
|
||||
DatFormat = datFormat,
|
||||
FileName = "test.dat",
|
||||
};
|
||||
|
||||
// Invoke the method
|
||||
string outDir = "C:\\Test";
|
||||
var actual = datHeader.CreateOutFileNames(outDir, overwrite: true);
|
||||
|
||||
// Check the result
|
||||
string expected = $"{outDir}\\test.{extension}";
|
||||
Assert.Single(actual);
|
||||
Assert.Equal(expected, actual[datFormat]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CreateOutFileNamesAllOutputsTest()
|
||||
{
|
||||
// Create the empty DatHeader
|
||||
var datHeader = new DatHeader
|
||||
{
|
||||
DatFormat = DatFormat.ALL,
|
||||
FileName = "test.dat",
|
||||
};
|
||||
|
||||
// Invoke the method
|
||||
string outDir = "C:\\Test";
|
||||
var actual = datHeader.CreateOutFileNames(outDir, overwrite: true);
|
||||
|
||||
// Check the result
|
||||
Assert.Equal(25, actual.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SabreTools.Core\SabreTools.Core.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.DatFiles\SabreTools.DatFiles.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.DatItems\SabreTools.DatItems.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.FileTypes\SabreTools.FileTypes.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.Filtering\SabreTools.Filtering.csproj" />
|
||||
|
||||
Reference in New Issue
Block a user