mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
47 lines
1.6 KiB
C#
47 lines
1.6 KiB
C#
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();
|
|
datHeader.SetFieldValue<string?>(DatHeader.FileNameKey, "test.dat");
|
|
datHeader.SetFieldValue<DatFormat>(DatHeader.DatFormatKey, datFormat);
|
|
|
|
// 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();
|
|
datHeader.SetFieldValue<string?>(DatHeader.FileNameKey, "test.dat");
|
|
datHeader.SetFieldValue<DatFormat>(DatHeader.DatFormatKey, DatFormat.ALL);
|
|
|
|
// Invoke the method
|
|
string outDir = "C:\\Test";
|
|
var actual = datHeader.CreateOutFileNames(outDir, overwrite: true);
|
|
|
|
// Check the result
|
|
Assert.Equal(26, actual.Count);
|
|
}
|
|
}
|
|
} |