2024-12-02 11:07:01 -05:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
using BinaryObjectScanner.FileType;
|
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BinaryObjectScanner.Test.FileType
|
|
|
|
|
|
{
|
|
|
|
|
|
public class PLJTests
|
|
|
|
|
|
{
|
2025-09-06 10:40:26 -04:00
|
|
|
|
private static readonly SabreTools.Serialization.Wrappers.PlayJAudioFile wrapper
|
2025-09-29 08:01:50 -04:00
|
|
|
|
= new(new SabreTools.Data.Models.PlayJ.AudioFile(), new MemoryStream(new byte[1024]));
|
2025-09-06 10:40:26 -04:00
|
|
|
|
|
2024-12-02 11:07:01 -05:00
|
|
|
|
[Fact]
|
2024-12-02 11:21:14 -05:00
|
|
|
|
public void DetectFile_EmptyString_Null()
|
2024-12-02 11:07:01 -05:00
|
|
|
|
{
|
|
|
|
|
|
string file = string.Empty;
|
2025-09-06 10:40:26 -04:00
|
|
|
|
var detectable = new PLJ(wrapper);
|
2024-12-02 11:07:01 -05:00
|
|
|
|
|
|
|
|
|
|
string? actual = detectable.Detect(file, includeDebug: false);
|
|
|
|
|
|
Assert.Null(actual);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
2025-09-06 10:51:00 -04:00
|
|
|
|
public void DetectStream_EmptyStream_DefaultValue()
|
2024-12-02 11:07:01 -05:00
|
|
|
|
{
|
|
|
|
|
|
Stream? stream = new MemoryStream();
|
|
|
|
|
|
string file = string.Empty;
|
2025-09-06 10:40:26 -04:00
|
|
|
|
var detectable = new PLJ(wrapper);
|
2024-12-02 11:07:01 -05:00
|
|
|
|
|
|
|
|
|
|
string? actual = detectable.Detect(stream, file, includeDebug: false);
|
2025-09-06 10:51:00 -04:00
|
|
|
|
Assert.Equal("PlayJ Audio File", actual);
|
2024-12-02 11:07:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|