mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-11 21:29:18 +00:00
* Fixes .hdr+.cab installshield cabinet files not being extracted when relative paths are provided. * Fix for unit tests empty file string. * Better fix for unit test failures, due to https://learn.microsoft.com/en-us/dotnet/api/system.io.path.getfullpath?view=net-9.0 listing several more exceptions than the other functions, most of which I would not imagine should be directly handled. * Removed try-catch fullpath obtaining, added getting fullpath in scanner via filestream name instead. * Undid previous changes again, re-added path assertion at request, added assert.throws exception for empty paths in the unit tests
44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using System;
|
|
using System.IO;
|
|
using BinaryObjectScanner.FileType;
|
|
using Xunit;
|
|
|
|
namespace BinaryObjectScanner.Test.FileType
|
|
{
|
|
public class InstallShieldCABTests
|
|
{
|
|
[Fact]
|
|
public void ExtractFile_EmptyString_False()
|
|
{
|
|
string file = string.Empty;
|
|
string outDir = string.Empty;
|
|
var extractable = new InstallShieldCAB();
|
|
|
|
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
|
Assert.False(actual);
|
|
}
|
|
|
|
[Fact]
|
|
public void ExtractStream_Null_False()
|
|
{
|
|
Stream? stream = null;
|
|
string file = string.Empty;
|
|
string outDir = string.Empty;
|
|
var extractable = new InstallShieldCAB();
|
|
|
|
Assert.Throws<ArgumentException>(() => extractable.Extract(stream, file, outDir, includeDebug: false));
|
|
}
|
|
|
|
[Fact]
|
|
public void ExtractStream_Empty_False()
|
|
{
|
|
Stream? stream = new MemoryStream();
|
|
string file = string.Empty;
|
|
string outDir = string.Empty;
|
|
var extractable = new InstallShieldCAB();
|
|
|
|
Assert.Throws<ArgumentException>(() => extractable.Extract(stream, file, outDir, includeDebug: false));
|
|
}
|
|
}
|
|
}
|