mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-08 21:31:45 +00:00
* Improve detection for cd/dvd-cops version string * I forgot to include the regex compensation for comma version number cases * Pasted comment wrong previously * Implemented Sabre's review fixes, also added check for Codefree
57 lines
1.7 KiB
C#
57 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using BinaryObjectScanner.Protection;
|
|
using Xunit;
|
|
|
|
namespace BinaryObjectScanner.Test.Protection
|
|
{
|
|
public class CDDVDCopsTests
|
|
{
|
|
[Fact]
|
|
public void CheckNewExecutableTest()
|
|
{
|
|
string file = "filename";
|
|
SabreTools.Models.NewExecutable.Executable model = new();
|
|
Stream source = new MemoryStream();
|
|
SabreTools.Serialization.Wrappers.NewExecutable nex = new(model, source);
|
|
|
|
var checker = new CDDVDCops();
|
|
string? actual = checker.CheckExecutable(file, nex, includeDebug: false);
|
|
Assert.Null(actual);
|
|
}
|
|
|
|
[Fact]
|
|
public void CheckPortableExecutableTest()
|
|
{
|
|
string file = "filename";
|
|
SabreTools.Models.PortableExecutable.Executable model = new();
|
|
Stream source = new MemoryStream();
|
|
SabreTools.Serialization.Wrappers.PortableExecutable pex = new(model, source);
|
|
|
|
var checker = new CDDVDCops();
|
|
string? actual = checker.CheckExecutable(file, pex, includeDebug: false);
|
|
Assert.Null(actual);
|
|
}
|
|
|
|
[Fact]
|
|
public void CheckDirectoryPathTest()
|
|
{
|
|
string path = "path";
|
|
List<string> files = [];
|
|
|
|
var checker = new CDDVDCops();
|
|
List<string> actual = checker.CheckDirectoryPath(path, files);
|
|
Assert.Empty(actual);
|
|
}
|
|
|
|
[Fact]
|
|
public void CheckFilePathTest()
|
|
{
|
|
string path = "path";
|
|
|
|
var checker = new CDDVDCops();
|
|
string? actual = checker.CheckFilePath(path);
|
|
Assert.Null(actual);
|
|
}
|
|
}
|
|
} |