mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-04 05:35:49 +00:00
Fix all broken tests from previous update
This commit is contained in:
@@ -63,7 +63,7 @@ namespace BinaryObjectScanner.Test
|
||||
WrapperType.BZip2,
|
||||
WrapperType.CFB,
|
||||
//WrapperType.CIA,
|
||||
//WrapperType.Executable,
|
||||
WrapperType.Executable,
|
||||
WrapperType.GCF,
|
||||
WrapperType.GZip,
|
||||
WrapperType.InstallShieldArchiveV3,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user