Files

35 lines
1.0 KiB
C#
Raw Permalink Normal View History

2025-09-02 20:31:30 -04:00
using System.IO;
2024-12-02 11:07:01 -05:00
using BinaryObjectScanner.FileType;
using Xunit;
namespace BinaryObjectScanner.Test.FileType
{
2025-09-06 09:53:34 -04:00
public class NewExecutableTests
2024-12-02 11:07:01 -05:00
{
2025-09-06 10:40:26 -04:00
private static readonly SabreTools.Serialization.Wrappers.NewExecutable wrapper
2025-09-29 08:01:50 -04:00
= new(new SabreTools.Data.Models.NewExecutable.Executable(), new MemoryStream(new byte[1024]));
2025-09-06 10:40:26 -04:00
2024-12-02 11:07:01 -05:00
[Fact]
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 NewExecutable(wrapper);
2024-12-02 11:07:01 -05:00
string? actual = detectable.Detect(file, includeDebug: false);
Assert.Null(actual);
}
[Fact]
2025-09-06 10:40:26 -04:00
public void DetectStream_EmptyStream_Empty()
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 NewExecutable(wrapper);
2024-12-02 11:07:01 -05:00
string? actual = detectable.Detect(stream, file, includeDebug: false);
2025-09-06 10:40:26 -04:00
Assert.NotNull(actual);
Assert.Empty(actual);
2024-12-02 11:07:01 -05:00
}
}
}