mirror of
https://github.com/RPCS3/discord-bot.git
synced 2024-11-26 19:50:36 +00:00
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using System.IO;
|
|
using IrdLibraryClient.IrdFormat;
|
|
using NUnit.Framework;
|
|
|
|
namespace Tests;
|
|
|
|
[TestFixture, Explicit("Requires files to run")]
|
|
public class IrdTests
|
|
{
|
|
[Test]
|
|
public void ParsingTest()
|
|
{
|
|
var baseDir = TestContext.CurrentContext.TestDirectory;
|
|
var testFiles = Directory.GetFiles(baseDir, "*.ird", SearchOption.AllDirectories);
|
|
Assert.That(testFiles, Is.Not.Empty);
|
|
|
|
foreach (var file in testFiles)
|
|
{
|
|
var bytes = File.ReadAllBytes(file);
|
|
Assert.That(() => IrdParser.Parse(bytes), Throws.Nothing, "Failed to parse " + Path.GetFileName(file));
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public void HeaderParsingTest()
|
|
{
|
|
var baseDir = TestContext.CurrentContext.TestDirectory;
|
|
var testFiles = Directory.GetFiles(baseDir, "*.ird", SearchOption.AllDirectories);
|
|
Assert.That(testFiles, Is.Not.Empty);
|
|
|
|
foreach (var file in testFiles)
|
|
{
|
|
var bytes = File.ReadAllBytes(file);
|
|
var ird = IrdParser.Parse(bytes);
|
|
Assert.That(ird.FileCount, Is.GreaterThan(0));
|
|
|
|
var fileList = ird.GetFilenames();
|
|
Assert.That(fileList, Has.Count.EqualTo(ird.FileCount));
|
|
}
|
|
}
|
|
} |