diff --git a/BinaryObjectScanner.Test/FileType/AACSMediaKeyBlockTests.cs b/BinaryObjectScanner.Test/FileType/AACSMediaKeyBlockTests.cs new file mode 100644 index 00000000..2433eab2 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/AACSMediaKeyBlockTests.cs @@ -0,0 +1,31 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class AACSMediaKeyBlockTests + { + [Fact] + public void DetectFileTest() + { + string file = string.Empty; + var detectable = new AACSMediaKeyBlock(); + + string? actual = detectable.Detect(file, includeDebug: false); + Assert.Null(actual); + } + + [Fact] + public void DetectStream() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + var detectable = new AACSMediaKeyBlock(); + + string? actual = detectable.Detect(stream, file, includeDebug: false); + Assert.Null(actual); + } + } +} + diff --git a/BinaryObjectScanner.Test/FileType/BDPlusSVMTests.cs b/BinaryObjectScanner.Test/FileType/BDPlusSVMTests.cs new file mode 100644 index 00000000..0bc35a49 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/BDPlusSVMTests.cs @@ -0,0 +1,31 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class BDPlusSVMTests + { + [Fact] + public void DetectFileTest() + { + string file = string.Empty; + var detectable = new BDPlusSVM(); + + string? actual = detectable.Detect(file, includeDebug: false); + Assert.Null(actual); + } + + [Fact] + public void DetectStream() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + var detectable = new BDPlusSVM(); + + string? actual = detectable.Detect(stream, file, includeDebug: false); + Assert.Null(actual); + } + } +} + diff --git a/BinaryObjectScanner.Test/FileType/BFPKTests.cs b/BinaryObjectScanner.Test/FileType/BFPKTests.cs new file mode 100644 index 00000000..9414e4e1 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/BFPKTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class BFPKTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new BFPK(); + + 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 BFPK(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new BFPK(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/BSPTests.cs b/BinaryObjectScanner.Test/FileType/BSPTests.cs new file mode 100644 index 00000000..01ef96eb --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/BSPTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class BSPTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new BSP(); + + 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 BSP(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new BSP(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/BZip2Tests.cs b/BinaryObjectScanner.Test/FileType/BZip2Tests.cs new file mode 100644 index 00000000..017a753a --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/BZip2Tests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class BZip2Tests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new BZip2(); + + 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 BZip2(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new BZip2(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/CFBTests.cs b/BinaryObjectScanner.Test/FileType/CFBTests.cs new file mode 100644 index 00000000..b10ee142 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/CFBTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class CFBTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new CFB(); + + 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 CFB(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new CFB(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/ExecutableTests.cs b/BinaryObjectScanner.Test/FileType/ExecutableTests.cs new file mode 100644 index 00000000..a74957fa --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/ExecutableTests.cs @@ -0,0 +1,31 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class ExecutableTests + { + [Fact] + public void DetectFileTest() + { + string file = string.Empty; + var detectable = new Executable(); + + string? actual = detectable.Detect(file, includeDebug: false); + Assert.Null(actual); + } + + [Fact] + public void DetectStream() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + var detectable = new Executable(); + + string? actual = detectable.Detect(stream, file, includeDebug: false); + Assert.Null(actual); + } + } +} + diff --git a/BinaryObjectScanner.Test/FileType/GCFTests.cs b/BinaryObjectScanner.Test/FileType/GCFTests.cs new file mode 100644 index 00000000..66aef36d --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/GCFTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class GCFTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new GCF(); + + 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 GCF(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new GCF(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/GZIPTests.cs b/BinaryObjectScanner.Test/FileType/GZIPTests.cs new file mode 100644 index 00000000..b91a0100 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/GZIPTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class GZIPTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new GZIP(); + + 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 GZIP(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new GZIP(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/InstallShieldArchiveV3Tests.cs b/BinaryObjectScanner.Test/FileType/InstallShieldArchiveV3Tests.cs new file mode 100644 index 00000000..53ce85c6 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/InstallShieldArchiveV3Tests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class InstallShieldArchiveV3Tests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new InstallShieldArchiveV3(); + + 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 InstallShieldArchiveV3(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new InstallShieldArchiveV3(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/InstallShieldCABTests.cs b/BinaryObjectScanner.Test/FileType/InstallShieldCABTests.cs new file mode 100644 index 00000000..36205506 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/InstallShieldCABTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class InstallShieldCABTests + { + [Fact] + public void ExtractFileTest() + { + 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(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new InstallShieldCAB(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/LDSCRYPTTests.cs b/BinaryObjectScanner.Test/FileType/LDSCRYPTTests.cs new file mode 100644 index 00000000..690b5e4e --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/LDSCRYPTTests.cs @@ -0,0 +1,31 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class LDSCRYPTTests + { + [Fact] + public void DetectFileTest() + { + string file = string.Empty; + var detectable = new LDSCRYPT(); + + string? actual = detectable.Detect(file, includeDebug: false); + Assert.Null(actual); + } + + [Fact] + public void DetectStream() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + var detectable = new LDSCRYPT(); + + string? actual = detectable.Detect(stream, file, includeDebug: false); + Assert.Null(actual); + } + } +} + diff --git a/BinaryObjectScanner.Test/FileType/MPQTests.cs b/BinaryObjectScanner.Test/FileType/MPQTests.cs new file mode 100644 index 00000000..5e2688aa --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/MPQTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class MPQTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new MPQ(); + + 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 MPQ(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new MPQ(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/MicrosoftCABTests.cs b/BinaryObjectScanner.Test/FileType/MicrosoftCABTests.cs new file mode 100644 index 00000000..ab77c8c0 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/MicrosoftCABTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class MicrosoftCABTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new MicrosoftCAB(); + + 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 MicrosoftCAB(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new MicrosoftCAB(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/MicrosoftLZTests.cs b/BinaryObjectScanner.Test/FileType/MicrosoftLZTests.cs new file mode 100644 index 00000000..7c5a9477 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/MicrosoftLZTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class MicrosoftLZTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new MicrosoftLZ(); + + 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 MicrosoftLZ(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new MicrosoftLZ(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/PAKTests.cs b/BinaryObjectScanner.Test/FileType/PAKTests.cs new file mode 100644 index 00000000..ab3eb659 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/PAKTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class PAKTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new PAK(); + + 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 PAK(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new PAK(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/PFFTests.cs b/BinaryObjectScanner.Test/FileType/PFFTests.cs new file mode 100644 index 00000000..bfe54362 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/PFFTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class PFFTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new PFF(); + + 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 PFF(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new PFF(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/PKZIPTests.cs b/BinaryObjectScanner.Test/FileType/PKZIPTests.cs new file mode 100644 index 00000000..71984088 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/PKZIPTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class PKZIPTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new PKZIP(); + + 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 PKZIP(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new PKZIP(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/PLJTests.cs b/BinaryObjectScanner.Test/FileType/PLJTests.cs new file mode 100644 index 00000000..95231dc0 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/PLJTests.cs @@ -0,0 +1,31 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class PLJTests + { + [Fact] + public void DetectFileTest() + { + string file = string.Empty; + var detectable = new PLJ(); + + string? actual = detectable.Detect(file, includeDebug: false); + Assert.Null(actual); + } + + [Fact] + public void DetectStream() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + var detectable = new PLJ(); + + string? actual = detectable.Detect(stream, file, includeDebug: false); + Assert.Null(actual); + } + } +} + diff --git a/BinaryObjectScanner.Test/FileType/QuantumTests.cs b/BinaryObjectScanner.Test/FileType/QuantumTests.cs new file mode 100644 index 00000000..7ebd7c03 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/QuantumTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class QuantumTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new Quantum(); + + 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 Quantum(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new Quantum(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/RARTests.cs b/BinaryObjectScanner.Test/FileType/RARTests.cs new file mode 100644 index 00000000..2b8891aa --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/RARTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class RARTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new RAR(); + + 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 RAR(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new RAR(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/RealArcadeInstallerTests.cs b/BinaryObjectScanner.Test/FileType/RealArcadeInstallerTests.cs new file mode 100644 index 00000000..4a9c698f --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/RealArcadeInstallerTests.cs @@ -0,0 +1,31 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class RealArcadeInstallerTests + { + [Fact] + public void DetectFileTest() + { + string file = string.Empty; + var detectable = new RealArcadeInstaller(); + + string? actual = detectable.Detect(file, includeDebug: false); + Assert.Null(actual); + } + + [Fact] + public void DetectStream() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + var detectable = new RealArcadeInstaller(); + + string? actual = detectable.Detect(stream, file, includeDebug: false); + Assert.Null(actual); + } + } +} + diff --git a/BinaryObjectScanner.Test/FileType/RealArcadeMezzanineTests.cs b/BinaryObjectScanner.Test/FileType/RealArcadeMezzanineTests.cs new file mode 100644 index 00000000..1838f919 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/RealArcadeMezzanineTests.cs @@ -0,0 +1,31 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class RealArcadeMezzanineTests + { + [Fact] + public void DetectFileTest() + { + string file = string.Empty; + var detectable = new RealArcadeMezzanine(); + + string? actual = detectable.Detect(file, includeDebug: false); + Assert.Null(actual); + } + + [Fact] + public void DetectStream() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + var detectable = new RealArcadeMezzanine(); + + string? actual = detectable.Detect(stream, file, includeDebug: false); + Assert.Null(actual); + } + } +} + diff --git a/BinaryObjectScanner.Test/FileType/SFFSTests.cs b/BinaryObjectScanner.Test/FileType/SFFSTests.cs new file mode 100644 index 00000000..d399a9f4 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/SFFSTests.cs @@ -0,0 +1,65 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class SFFSTests + { + [Fact] + public void DetectFileTest() + { + string file = string.Empty; + var detectable = new SFFS(); + + string? actual = detectable.Detect(file, includeDebug: false); + Assert.Null(actual); + } + + [Fact] + public void DetectStream() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + var detectable = new SFFS(); + + string? actual = detectable.Detect(stream, file, includeDebug: false); + Assert.Null(actual); + } + + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new SFFS(); + + 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 SFFS(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new SFFS(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/SGATests.cs b/BinaryObjectScanner.Test/FileType/SGATests.cs new file mode 100644 index 00000000..543ebb26 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/SGATests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class SGATests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new SGA(); + + 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 SGA(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new SGA(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/SevenZipTests.cs b/BinaryObjectScanner.Test/FileType/SevenZipTests.cs new file mode 100644 index 00000000..419fbccf --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/SevenZipTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class SevenZipTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new SevenZip(); + + 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 SevenZip(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new SevenZip(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/TapeArchiveTests.cs b/BinaryObjectScanner.Test/FileType/TapeArchiveTests.cs new file mode 100644 index 00000000..be57fe05 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/TapeArchiveTests.cs @@ -0,0 +1,46 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class TapeArchiveTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new TapeArchive(); + + 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 TapeArchive(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new TapeArchive(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + + // TODO: Unexpected result -- Empty file recognized as valid + Assert.True(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/TextfileTests.cs b/BinaryObjectScanner.Test/FileType/TextfileTests.cs new file mode 100644 index 00000000..8a24a5ff --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/TextfileTests.cs @@ -0,0 +1,31 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class TextfileTests + { + [Fact] + public void DetectFileTest() + { + string file = string.Empty; + var detectable = new Textfile(); + + string? actual = detectable.Detect(file, includeDebug: false); + Assert.Null(actual); + } + + [Fact] + public void DetectStream() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + var detectable = new Textfile(); + + string? actual = detectable.Detect(stream, file, includeDebug: false); + Assert.Null(actual); + } + } +} + diff --git a/BinaryObjectScanner.Test/FileType/VBSPTests.cs b/BinaryObjectScanner.Test/FileType/VBSPTests.cs new file mode 100644 index 00000000..9f3d71f3 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/VBSPTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class VBSPTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new VBSP(); + + 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 VBSP(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new VBSP(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/VPKTests.cs b/BinaryObjectScanner.Test/FileType/VPKTests.cs new file mode 100644 index 00000000..d25ed582 --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/VPKTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class VPKTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new VPK(); + + 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 VPK(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new VPK(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/WAD3Tests.cs b/BinaryObjectScanner.Test/FileType/WAD3Tests.cs new file mode 100644 index 00000000..9826adfc --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/WAD3Tests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class WAD3Tests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new WAD3(); + + 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 WAD3(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new WAD3(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/XZPTests.cs b/BinaryObjectScanner.Test/FileType/XZPTests.cs new file mode 100644 index 00000000..4f732f9d --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/XZPTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class XZPTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new XZP(); + + 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 XZP(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new XZP(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner.Test/FileType/XZTests.cs b/BinaryObjectScanner.Test/FileType/XZTests.cs new file mode 100644 index 00000000..c119e20c --- /dev/null +++ b/BinaryObjectScanner.Test/FileType/XZTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using BinaryObjectScanner.FileType; +using Xunit; + +namespace BinaryObjectScanner.Test.FileType +{ + public class XZTests + { + [Fact] + public void ExtractFileTest() + { + string file = string.Empty; + string outDir = string.Empty; + var extractable = new XZ(); + + 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 XZ(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + + [Fact] + public void ExtractStream_Empty_False() + { + Stream? stream = new MemoryStream(); + string file = string.Empty; + string outDir = string.Empty; + var extractable = new XZ(); + + bool actual = extractable.Extract(stream, file, outDir, includeDebug: false); + Assert.False(actual); + } + } +} diff --git a/BinaryObjectScanner/FileType/Textfile.cs b/BinaryObjectScanner/FileType/Textfile.cs index 2e4eed2f..03b7af03 100644 --- a/BinaryObjectScanner/FileType/Textfile.cs +++ b/BinaryObjectScanner/FileType/Textfile.cs @@ -74,7 +74,7 @@ namespace BinaryObjectScanner.FileType protections.Add("CopyKiller V3.62-V3.64"); // Found in "engine.wzc" in CopyKiller versions 3.99 and 3.99a. else if (fileContent.Contains("CopyKiller V3.99x Protection Engine")) - protections.Add("CopyKiller V3.99+"); + protections.Add("CopyKiller V3.99+"); // Freelock // Found in "FILE_ID.DIZ" distributed with Freelock. @@ -181,7 +181,11 @@ namespace BinaryObjectScanner.FileType if (includeDebug) Console.WriteLine(ex); } - return string.Join(";", [.. protections]); + // Only return if there are protections found + if (protections.Count > 0) + return string.Join(";", [.. protections]); + + return null; } } }