mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Update NUnit.
This commit is contained in:
@@ -35,7 +35,7 @@ public abstract class FsExtractIssueTest
|
||||
Dictionary<string, string> options = ParsedOptions;
|
||||
options["debug"] = Debug.ToString();
|
||||
|
||||
Assert.IsNotNull(inputFilter, Localization.Cannot_open_specified_file);
|
||||
Assert.That(inputFilter, Is.Not.Null, Localization.Cannot_open_specified_file);
|
||||
|
||||
Encoding encodingClass = null;
|
||||
|
||||
@@ -45,15 +45,17 @@ public abstract class FsExtractIssueTest
|
||||
|
||||
var imageFormat = ImageFormat.Detect(inputFilter) as IMediaImage;
|
||||
|
||||
Assert.NotNull(imageFormat, Localization.Image_format_not_identified_not_proceeding_with_analysis);
|
||||
Assert.That(imageFormat, Is.Not.Null, Localization.Image_format_not_identified_not_proceeding_with_analysis);
|
||||
|
||||
Assert.AreEqual(ErrorNumber.NoError, imageFormat.Open(inputFilter), Localization.Unable_to_open_image_format);
|
||||
Assert.That(imageFormat.Open(inputFilter),
|
||||
Is.EqualTo(ErrorNumber.NoError),
|
||||
Localization.Unable_to_open_image_format);
|
||||
|
||||
List<Partition> partitions = Core.Partitions.GetAll(imageFormat);
|
||||
|
||||
if(partitions.Count == 0)
|
||||
{
|
||||
Assert.IsFalse(ExpectPartitions, Localization.No_partitions_found);
|
||||
Assert.That(ExpectPartitions, Is.False, Localization.No_partitions_found);
|
||||
|
||||
partitions.Add(new Partition
|
||||
{
|
||||
@@ -82,15 +84,17 @@ public abstract class FsExtractIssueTest
|
||||
{
|
||||
if(!plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out IReadOnlyFilesystem fs)) continue;
|
||||
|
||||
Assert.IsNotNull(fs, string.Format(Localization.Could_not_instantiate_filesystem_0, pluginName));
|
||||
Assert.That(fs,
|
||||
Is.Not.Null,
|
||||
string.Format(Localization.Could_not_instantiate_filesystem_0, pluginName));
|
||||
|
||||
filesystemFound = true;
|
||||
|
||||
error = fs.Mount(imageFormat, partitions[i], encodingClass, options, Namespace);
|
||||
|
||||
Assert.AreEqual(ErrorNumber.NoError,
|
||||
error,
|
||||
string.Format(Localization.Could_not_mount_0_in_partition_1, pluginName, i));
|
||||
Assert.That(error,
|
||||
Is.EqualTo(ErrorNumber.NoError),
|
||||
string.Format(Localization.Could_not_mount_0_in_partition_1, pluginName, i));
|
||||
|
||||
ExtractFilesInDir("/", fs, Xattrs);
|
||||
}
|
||||
@@ -99,21 +103,21 @@ public abstract class FsExtractIssueTest
|
||||
{
|
||||
plugins.ReadOnlyFilesystems.TryGetValue(idPlugins[0], out IReadOnlyFilesystem fs);
|
||||
|
||||
Assert.IsNotNull(fs, string.Format(Localization.Could_not_instantiate_filesystem_0, fs?.Name));
|
||||
Assert.That(fs, Is.Not.Null, string.Format(Localization.Could_not_instantiate_filesystem_0, fs?.Name));
|
||||
|
||||
filesystemFound = true;
|
||||
|
||||
error = fs.Mount(imageFormat, partitions[i], encodingClass, options, Namespace);
|
||||
|
||||
Assert.AreEqual(ErrorNumber.NoError,
|
||||
error,
|
||||
string.Format(Localization.Could_not_mount_0_in_partition_1, fs.Name, i));
|
||||
Assert.That(error,
|
||||
Is.EqualTo(ErrorNumber.NoError),
|
||||
string.Format(Localization.Could_not_mount_0_in_partition_1, fs.Name, i));
|
||||
|
||||
ExtractFilesInDir("/", fs, Xattrs);
|
||||
}
|
||||
}
|
||||
|
||||
Assert.IsTrue(filesystemFound, Localization.No_filesystems_found);
|
||||
Assert.That(filesystemFound, Localization.No_filesystems_found);
|
||||
}
|
||||
|
||||
static void ExtractFilesInDir(string path, IReadOnlyFilesystem fs, bool doXattrs)
|
||||
@@ -122,17 +126,17 @@ public abstract class FsExtractIssueTest
|
||||
|
||||
ErrorNumber error = fs.OpenDir(path, out IDirNode node);
|
||||
|
||||
Assert.AreEqual(ErrorNumber.NoError,
|
||||
error,
|
||||
string.Format(Localization.Error_0_reading_root_directory, error.ToString()));
|
||||
Assert.That(error,
|
||||
Is.EqualTo(ErrorNumber.NoError),
|
||||
string.Format(Localization.Error_0_reading_root_directory, error.ToString()));
|
||||
|
||||
while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError && entry is not null)
|
||||
{
|
||||
error = fs.Stat(path + "/" + entry, out FileEntryInfo stat);
|
||||
|
||||
Assert.AreEqual(ErrorNumber.NoError,
|
||||
error,
|
||||
string.Format(Localization.Error_getting_stat_for_entry_0, entry));
|
||||
Assert.That(error,
|
||||
Is.EqualTo(ErrorNumber.NoError),
|
||||
string.Format(Localization.Error_getting_stat_for_entry_0, entry));
|
||||
|
||||
if(stat.Attributes.HasFlag(FileAttributes.Directory))
|
||||
{
|
||||
@@ -145,11 +149,11 @@ public abstract class FsExtractIssueTest
|
||||
{
|
||||
error = fs.ListXAttr(path + "/" + entry, out List<string> xattrs);
|
||||
|
||||
Assert.AreEqual(ErrorNumber.NoError,
|
||||
error,
|
||||
string.Format(Localization.Error_0_getting_extended_attributes_for_entry_1,
|
||||
error,
|
||||
path + "/" + entry));
|
||||
Assert.That(error,
|
||||
Is.EqualTo(ErrorNumber.NoError),
|
||||
string.Format(Localization.Error_0_getting_extended_attributes_for_entry_1,
|
||||
error,
|
||||
path + "/" + entry));
|
||||
|
||||
if(error == ErrorNumber.NoError)
|
||||
{
|
||||
@@ -158,11 +162,11 @@ public abstract class FsExtractIssueTest
|
||||
byte[] xattrBuf = [];
|
||||
error = fs.GetXattr(path + "/" + entry, xattr, ref xattrBuf);
|
||||
|
||||
Assert.AreEqual(ErrorNumber.NoError,
|
||||
error,
|
||||
string.Format(Localization.Error_0_reading_extended_attributes_for_entry_1,
|
||||
error,
|
||||
path + "/" + entry));
|
||||
Assert.That(error,
|
||||
Is.EqualTo(ErrorNumber.NoError),
|
||||
string.Format(Localization.Error_0_reading_extended_attributes_for_entry_1,
|
||||
error,
|
||||
path + "/" + entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,22 +174,19 @@ public abstract class FsExtractIssueTest
|
||||
var buffer = new byte[stat.Length];
|
||||
ErrorNumber ret = fs.OpenFile(path + "/" + entry, out IFileNode fileNode);
|
||||
|
||||
Assert.AreEqual(ErrorNumber.NoError,
|
||||
ret,
|
||||
string.Format(Localization.Error_0_reading_file_1, ret, path + "/" + entry));
|
||||
Assert.That(ret,
|
||||
Is.EqualTo(ErrorNumber.NoError),
|
||||
string.Format(Localization.Error_0_reading_file_1, ret, path + "/" + entry));
|
||||
|
||||
ret = fs.ReadFile(fileNode, stat.Length, buffer, out long readBytes);
|
||||
|
||||
Assert.AreEqual(ErrorNumber.NoError,
|
||||
ret,
|
||||
string.Format(Localization.Error_0_reading_file_1, ret, path + "/" + entry));
|
||||
Assert.That(ret,
|
||||
Is.EqualTo(ErrorNumber.NoError),
|
||||
string.Format(Localization.Error_0_reading_file_1, ret, path + "/" + entry));
|
||||
|
||||
Assert.AreEqual(stat.Length,
|
||||
readBytes,
|
||||
string.Format(Localization.Error_0_reading_file_1,
|
||||
readBytes,
|
||||
stat.Length,
|
||||
path + "/" + entry));
|
||||
Assert.That(readBytes,
|
||||
Is.EqualTo(stat.Length),
|
||||
string.Format(Localization.Error_0_reading_file_1, readBytes, stat.Length, path + "/" + entry));
|
||||
}
|
||||
|
||||
fs.CloseDir(node);
|
||||
|
||||
Reference in New Issue
Block a user