Fix all broken tests from previous update

This commit is contained in:
Matt Nadareski
2025-09-02 20:21:53 -04:00
parent 77ad6e791a
commit cc826fdc60
7 changed files with 23 additions and 7 deletions

View File

@@ -63,7 +63,7 @@ namespace BinaryObjectScanner.Test
WrapperType.BZip2,
WrapperType.CFB,
//WrapperType.CIA,
//WrapperType.Executable,
WrapperType.Executable,
WrapperType.GCF,
WrapperType.GZip,
WrapperType.InstallShieldArchiveV3,

View File

@@ -26,7 +26,8 @@ namespace BinaryObjectScanner.Test.FileType
string outDir = string.Empty;
var extractable = new InstallShieldCAB();
Assert.Throws<ArgumentException>(() => extractable.Extract(stream, file, outDir, includeDebug: false));
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
}
[Fact]
@@ -37,7 +38,8 @@ namespace BinaryObjectScanner.Test.FileType
string outDir = string.Empty;
var extractable = new InstallShieldCAB();
Assert.Throws<ArgumentException>(() => extractable.Extract(stream, file, outDir, includeDebug: false));
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
}
}
}

View File

@@ -30,7 +30,7 @@ namespace BinaryObjectScanner.Test.FileType
}
[Fact]
public void ExtractStream_Empty_True()
public void ExtractStream_Empty_False()
{
Stream? stream = new MemoryStream();
string file = string.Empty;
@@ -38,9 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
var extractable = new TapeArchive();
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
// Unexpected result -- Empty file recognized as valid in SharpCompress
Assert.True(actual);
Assert.False(actual);
}
}
}

View File

@@ -21,6 +21,10 @@ namespace BinaryObjectScanner.FileType
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Handle invalid inputs
if (stream == null || stream.Length == 0)
return false;
// Create the wrapper
var bzip = SabreTools.Serialization.Wrappers.BZip2.Create(stream);
if (bzip == null)

View File

@@ -21,6 +21,10 @@ namespace BinaryObjectScanner.FileType
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Handle invalid inputs
if (stream == null || stream.Length == 0)
return false;
// Create the wrapper
var rar = SabreTools.Serialization.Wrappers.RAR.Create(stream);
if (rar == null)

View File

@@ -21,6 +21,10 @@ namespace BinaryObjectScanner.FileType
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Handle invalid inputs
if (stream == null || stream.Length == 0)
return false;
// Create the wrapper
var sevenZip = SabreTools.Serialization.Wrappers.SevenZip.Create(stream);
if (sevenZip == null)

View File

@@ -21,6 +21,10 @@ namespace BinaryObjectScanner.FileType
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Handle invalid inputs
if (stream == null || stream.Length == 0)
return false;
// Create the wrapper
var xz = SabreTools.Serialization.Wrappers.XZ.Create(stream);
if (xz == null)