mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 11:14:25 +00:00
Update NUnit.
This commit is contained in:
@@ -18,7 +18,11 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Claunia.Encoding" Version="1.9.2"/>
|
<PackageReference Include="Claunia.Encoding" Version="1.9.2"/>
|
||||||
<PackageReference Include="FluentAssertions" Version="6.12.0"/>
|
<PackageReference Include="FluentAssertions" Version="6.12.0"/>
|
||||||
<PackageReference Include="nunit" Version="3.13.3"/>
|
<PackageReference Include="nunit" Version="4.1.0"/>
|
||||||
|
<PackageReference Include="NUnit.Analyzers" Version="4.2.0">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0"/>
|
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0"/>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0"/>
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0"/>
|
||||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0"/>
|
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0"/>
|
||||||
|
|||||||
@@ -107,14 +107,14 @@ public class Sha512
|
|||||||
fs.Close();
|
fs.Close();
|
||||||
fs.Dispose();
|
fs.Dispose();
|
||||||
Sha512Context.Data(data, out byte[] result);
|
Sha512Context.Data(data, out byte[] result);
|
||||||
Assert.AreEqual(_expectedRandom, result);
|
Assert.That(result, Is.EqualTo(_expectedRandom));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void RandomFile()
|
public void RandomFile()
|
||||||
{
|
{
|
||||||
byte[] result = Sha512Context.File(Path.Combine(Consts.TestFilesRoot, "Checksum test files", "random"));
|
byte[] result = Sha512Context.File(Path.Combine(Consts.TestFilesRoot, "Checksum test files", "random"));
|
||||||
Assert.AreEqual(_expectedRandom, result);
|
Assert.That(result, Is.EqualTo(_expectedRandom));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -132,6 +132,6 @@ public class Sha512
|
|||||||
IChecksum ctx = new Sha512Context();
|
IChecksum ctx = new Sha512Context();
|
||||||
ctx.Update(data);
|
ctx.Update(data);
|
||||||
byte[] result = ctx.Final();
|
byte[] result = ctx.Final();
|
||||||
Assert.AreEqual(_expectedRandom, result);
|
Assert.That(result, Is.EqualTo(_expectedRandom));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ public class SpamSum
|
|||||||
fs.Close();
|
fs.Close();
|
||||||
fs.Dispose();
|
fs.Dispose();
|
||||||
string result = SpamSumContext.Data(data, out _);
|
string result = SpamSumContext.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_EMPTY, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_EMPTY));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -71,7 +71,7 @@ public class SpamSum
|
|||||||
IChecksum ctx = new SpamSumContext();
|
IChecksum ctx = new SpamSumContext();
|
||||||
ctx.Update(data);
|
ctx.Update(data);
|
||||||
string result = ctx.End();
|
string result = ctx.End();
|
||||||
Assert.AreEqual(EXPECTED_EMPTY, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_EMPTY));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -87,7 +87,7 @@ public class SpamSum
|
|||||||
fs.Close();
|
fs.Close();
|
||||||
fs.Dispose();
|
fs.Dispose();
|
||||||
string result = SpamSumContext.Data(data, out _);
|
string result = SpamSumContext.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_RANDOM, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_RANDOM));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -105,6 +105,6 @@ public class SpamSum
|
|||||||
IChecksum ctx = new SpamSumContext();
|
IChecksum ctx = new SpamSumContext();
|
||||||
ctx.Update(data);
|
ctx.Update(data);
|
||||||
string result = ctx.End();
|
string result = ctx.End();
|
||||||
Assert.AreEqual(EXPECTED_RANDOM, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_RANDOM));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ public class IomegaJaz
|
|||||||
var image = new ZZZRawImage();
|
var image = new ZZZRawImage();
|
||||||
ErrorNumber opened = image.Open(filter);
|
ErrorNumber opened = image.Open(filter);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_0, _testFiles[i]));
|
Assert.That(opened, Is.EqualTo(ErrorNumber.NoError), string.Format(Localization.Open_0, _testFiles[i]));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) continue;
|
if(opened != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
@@ -73,17 +73,17 @@ public class IomegaJaz
|
|||||||
{
|
{
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.AreEqual(_sectors[i],
|
Assert.That(image.Info.Sectors,
|
||||||
image.Info.Sectors,
|
Is.EqualTo(_sectors[i]),
|
||||||
string.Format(Localization.Sectors_0, _testFiles[i]));
|
string.Format(Localization.Sectors_0, _testFiles[i]));
|
||||||
|
|
||||||
Assert.AreEqual(_sectorSize[i],
|
Assert.That(image.Info.SectorSize,
|
||||||
image.Info.SectorSize,
|
Is.EqualTo(_sectorSize[i]),
|
||||||
string.Format(Localization.Sector_size_0, _testFiles[i]));
|
string.Format(Localization.Sector_size_0, _testFiles[i]));
|
||||||
|
|
||||||
Assert.AreEqual(_mediaTypes[i],
|
Assert.That(image.Info.MediaType,
|
||||||
image.Info.MediaType,
|
Is.EqualTo(_mediaTypes[i]),
|
||||||
string.Format(Localization.Media_type_0, _testFiles[i]));
|
string.Format(Localization.Media_type_0, _testFiles[i]));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class Ls120
|
|||||||
var image = new ZZZRawImage();
|
var image = new ZZZRawImage();
|
||||||
ErrorNumber opened = image.Open(filter);
|
ErrorNumber opened = image.Open(filter);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_0, _testFiles[i]));
|
Assert.That(opened, Is.EqualTo(ErrorNumber.NoError), string.Format(Localization.Open_0, _testFiles[i]));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) continue;
|
if(opened != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
@@ -73,17 +73,17 @@ public class Ls120
|
|||||||
{
|
{
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.AreEqual(_sectors[i],
|
Assert.That(image.Info.Sectors,
|
||||||
image.Info.Sectors,
|
Is.EqualTo(_sectors[i]),
|
||||||
string.Format(Localization.Sectors_0, _testFiles[i]));
|
string.Format(Localization.Sectors_0, _testFiles[i]));
|
||||||
|
|
||||||
Assert.AreEqual(_sectorSize[i],
|
Assert.That(image.Info.SectorSize,
|
||||||
image.Info.SectorSize,
|
Is.EqualTo(_sectorSize[i]),
|
||||||
string.Format(Localization.Sector_size_0, _testFiles[i]));
|
string.Format(Localization.Sector_size_0, _testFiles[i]));
|
||||||
|
|
||||||
Assert.AreEqual(_mediaTypes[i],
|
Assert.That(image.Info.MediaType,
|
||||||
image.Info.MediaType,
|
Is.EqualTo(_mediaTypes[i]),
|
||||||
string.Format(Localization.Media_type_0, _testFiles[i]));
|
string.Format(Localization.Media_type_0, _testFiles[i]));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,33 +40,35 @@ public class CID
|
|||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
int count = Marshal.ConvertFromHexAscii(cids[i], out byte[] response);
|
int count = Marshal.ConvertFromHexAscii(cids[i], out byte[] response);
|
||||||
Assert.AreEqual(16, count, string.Format(Localization.Size_0, cards[i]));
|
Assert.That(count, Is.EqualTo(16), string.Format(Localization.Size_0, cards[i]));
|
||||||
Decoders.MMC.CID cid = Decoders.MMC.Decoders.DecodeCID(response);
|
Decoders.MMC.CID cid = Decoders.MMC.Decoders.DecodeCID(response);
|
||||||
Assert.IsNotNull(cid, string.Format(Localization.Decoded_0, cards[i]));
|
Assert.That(cid, Is.Not.Null, string.Format(Localization.Decoded_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(manufacturers[i],
|
Assert.That(cid.Manufacturer,
|
||||||
cid.Manufacturer,
|
Is.EqualTo(manufacturers[i]),
|
||||||
string.Format(Localization.Manufacturer_0, cards[i]));
|
string.Format(Localization.Manufacturer_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(applications[i],
|
Assert.That(cid.ApplicationID,
|
||||||
cid.ApplicationID,
|
Is.EqualTo(applications[i]),
|
||||||
string.Format(Localization.Application_ID_0, cards[i]));
|
string.Format(Localization.Application_ID_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(names[i], cid.ProductName, string.Format(Localization.Product_name_0, cards[i]));
|
Assert.That(cid.ProductName,
|
||||||
|
Is.EqualTo(names[i]),
|
||||||
|
string.Format(Localization.Product_name_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(revisions[i],
|
Assert.That(cid.ProductRevision,
|
||||||
cid.ProductRevision,
|
Is.EqualTo(revisions[i]),
|
||||||
string.Format(Localization.Product_revision_0, cards[i]));
|
string.Format(Localization.Product_revision_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(serials[i],
|
Assert.That(cid.ProductSerialNumber,
|
||||||
cid.ProductSerialNumber,
|
Is.EqualTo(serials[i]),
|
||||||
string.Format(Localization.Serial_number_0, cards[i]));
|
string.Format(Localization.Serial_number_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(dates[i],
|
Assert.That(cid.ManufacturingDate,
|
||||||
cid.ManufacturingDate,
|
Is.EqualTo(dates[i]),
|
||||||
string.Format(Localization.Manufacturing_date_0, cards[i]));
|
string.Format(Localization.Manufacturing_date_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(crcs[i], cid.CRC, string.Format(Localization.CRC_0, cards[i]));
|
Assert.That(cid.CRC, Is.EqualTo(crcs[i]), string.Format(Localization.CRC_0, cards[i]));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,116 +90,120 @@ public class CSD
|
|||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
int count = Marshal.ConvertFromHexAscii(csds[i], out byte[] response);
|
int count = Marshal.ConvertFromHexAscii(csds[i], out byte[] response);
|
||||||
Assert.AreEqual(16, count, string.Format(Localization.Size_0, cards[i]));
|
Assert.That(count, Is.EqualTo(16), string.Format(Localization.Size_0, cards[i]));
|
||||||
Decoders.MMC.CSD csd = Decoders.MMC.Decoders.DecodeCSD(response);
|
Decoders.MMC.CSD csd = Decoders.MMC.Decoders.DecodeCSD(response);
|
||||||
Assert.IsNotNull(csd, string.Format(Localization.Decoded_0, cards[i]));
|
Assert.That(csd, Is.Not.Null, string.Format(Localization.Decoded_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(structure_versions[i],
|
Assert.That(csd.Structure,
|
||||||
csd.Structure,
|
Is.EqualTo(structure_versions[i]),
|
||||||
string.Format(Localization.Structure_version_0, cards[i]));
|
string.Format(Localization.Structure_version_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(spec_versions[i],
|
Assert.That(csd.Version,
|
||||||
csd.Version,
|
Is.EqualTo(spec_versions[i]),
|
||||||
string.Format(Localization.Specification_version_0, cards[i]));
|
string.Format(Localization.Specification_version_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(taacs[i], csd.TAAC, string.Format(Localization.TAAC_0, cards[i]));
|
Assert.That(csd.TAAC, Is.EqualTo(taacs[i]), string.Format(Localization.TAAC_0, cards[i]));
|
||||||
Assert.AreEqual(nsacs[i], csd.NSAC, string.Format(Localization.NSAC_0, cards[i]));
|
Assert.That(csd.NSAC, Is.EqualTo(nsacs[i]), string.Format(Localization.NSAC_0, cards[i]));
|
||||||
Assert.AreEqual(speeds[i], csd.Speed, string.Format(Localization.Transfer_speed_0, cards[i]));
|
|
||||||
Assert.AreEqual(classes[i], csd.Classes, string.Format(Localization.Classes_0, cards[i]));
|
|
||||||
|
|
||||||
Assert.AreEqual(read_block_lengths[i],
|
Assert.That(csd.Speed,
|
||||||
csd.ReadBlockLength,
|
Is.EqualTo(speeds[i]),
|
||||||
string.Format(Localization.Read_block_length_0, cards[i]));
|
string.Format(Localization.Transfer_speed_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(read_partial_blocks[i],
|
Assert.That(csd.Classes, Is.EqualTo(classes[i]), string.Format(Localization.Classes_0, cards[i]));
|
||||||
csd.ReadsPartialBlocks,
|
|
||||||
string.Format(Localization.Reads_partial_blocks_0, cards[i]));
|
|
||||||
|
|
||||||
Assert.AreEqual(write_misaligned_block[i],
|
Assert.That(csd.ReadBlockLength,
|
||||||
csd.WriteMisalignment,
|
Is.EqualTo(read_block_lengths[i]),
|
||||||
string.Format(Localization.Writes_misaligned_blocks_0, cards[i]));
|
string.Format(Localization.Read_block_length_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(read_misaligned_block[i],
|
Assert.That(csd.ReadsPartialBlocks,
|
||||||
csd.ReadMisalignment,
|
Is.EqualTo(read_partial_blocks[i]),
|
||||||
string.Format(Localization.Reads_misaligned_blocks_0, cards[i]));
|
string.Format(Localization.Reads_partial_blocks_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(dsr_implemented[i],
|
Assert.That(csd.WriteMisalignment,
|
||||||
csd.DSRImplemented,
|
Is.EqualTo(write_misaligned_block[i]),
|
||||||
string.Format(Localization.DSR_implemented_0, cards[i]));
|
string.Format(Localization.Writes_misaligned_blocks_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(card_sizes[i], csd.Size, string.Format(Localization.Card_size_0, cards[i]));
|
Assert.That(csd.ReadMisalignment,
|
||||||
|
Is.EqualTo(read_misaligned_block[i]),
|
||||||
|
string.Format(Localization.Reads_misaligned_blocks_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(min_read_current[i],
|
Assert.That(csd.DSRImplemented,
|
||||||
csd.ReadCurrentAtVddMin,
|
Is.EqualTo(dsr_implemented[i]),
|
||||||
string.Format(Localization.Reading_current_at_minimum_Vdd_0, cards[i]));
|
string.Format(Localization.DSR_implemented_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(max_read_current[i],
|
Assert.That(csd.Size, Is.EqualTo(card_sizes[i]), string.Format(Localization.Card_size_0, cards[i]));
|
||||||
csd.ReadCurrentAtVddMax,
|
|
||||||
string.Format(Localization.Reading_current_at_maximum_Vdd_0, cards[i]));
|
|
||||||
|
|
||||||
Assert.AreEqual(min_write_current[i],
|
Assert.That(csd.ReadCurrentAtVddMin,
|
||||||
csd.WriteCurrentAtVddMin,
|
Is.EqualTo(min_read_current[i]),
|
||||||
string.Format(Localization.Writing_current_at_minimum_Vdd_0, cards[i]));
|
string.Format(Localization.Reading_current_at_minimum_Vdd_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(max_write_current[i],
|
Assert.That(csd.ReadCurrentAtVddMax,
|
||||||
csd.WriteCurrentAtVddMax,
|
Is.EqualTo(max_read_current[i]),
|
||||||
string.Format(Localization.Writing_current_at_maximum_Vdd_0, cards[i]));
|
string.Format(Localization.Reading_current_at_maximum_Vdd_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(size_multiplier[i],
|
Assert.That(csd.WriteCurrentAtVddMin,
|
||||||
csd.SizeMultiplier,
|
Is.EqualTo(min_write_current[i]),
|
||||||
string.Format(Localization.Card_size_multiplier_0, cards[i]));
|
string.Format(Localization.Writing_current_at_minimum_Vdd_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(sector_sizes[i],
|
Assert.That(csd.WriteCurrentAtVddMax,
|
||||||
csd.EraseGroupSize,
|
Is.EqualTo(max_write_current[i]),
|
||||||
string.Format(Localization.Erase_sector_size_0, cards[i]));
|
string.Format(Localization.Writing_current_at_maximum_Vdd_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(erase_sector_sizes[i],
|
Assert.That(csd.SizeMultiplier,
|
||||||
csd.EraseGroupSizeMultiplier,
|
Is.EqualTo(size_multiplier[i]),
|
||||||
string.Format(Localization.Erase_group_size_0, cards[i]));
|
string.Format(Localization.Card_size_multiplier_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(write_protect_group_size[i],
|
Assert.That(csd.EraseGroupSize,
|
||||||
csd.WriteProtectGroupSize,
|
Is.EqualTo(sector_sizes[i]),
|
||||||
string.Format(Localization.Write_protect_group_size_0, cards[i]));
|
string.Format(Localization.Erase_sector_size_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(write_protect_group_enable[i],
|
Assert.That(csd.EraseGroupSizeMultiplier,
|
||||||
csd.WriteProtectGroupEnable,
|
Is.EqualTo(erase_sector_sizes[i]),
|
||||||
string.Format(Localization.Write_protect_group_enable_0, cards[i]));
|
string.Format(Localization.Erase_group_size_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(default_eccs[i],
|
Assert.That(csd.WriteProtectGroupSize,
|
||||||
csd.DefaultECC,
|
Is.EqualTo(write_protect_group_size[i]),
|
||||||
string.Format(Localization.Default_ECC_0, cards[i]));
|
string.Format(Localization.Write_protect_group_size_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(r2w_factors[i],
|
Assert.That(csd.WriteProtectGroupEnable,
|
||||||
csd.WriteSpeedFactor,
|
Is.EqualTo(write_protect_group_enable[i]),
|
||||||
string.Format(Localization.Read_to_write_factor_0, cards[i]));
|
string.Format(Localization.Write_protect_group_enable_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(write_block_lengths[i],
|
Assert.That(csd.DefaultECC,
|
||||||
csd.WriteBlockLength,
|
Is.EqualTo(default_eccs[i]),
|
||||||
string.Format(Localization.write_block_length_0, cards[i]));
|
string.Format(Localization.Default_ECC_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(write_partial_blocks[i],
|
Assert.That(csd.WriteSpeedFactor,
|
||||||
csd.WritesPartialBlocks,
|
Is.EqualTo(r2w_factors[i]),
|
||||||
string.Format(Localization.Writes_partial_blocks_0, cards[i]));
|
string.Format(Localization.Read_to_write_factor_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(file_format_group[i],
|
Assert.That(csd.WriteBlockLength,
|
||||||
csd.FileFormatGroup,
|
Is.EqualTo(write_block_lengths[i]),
|
||||||
string.Format(Localization.File_format_group_0, cards[i]));
|
string.Format(Localization.write_block_length_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(copy[i], csd.Copy, string.Format(Localization.Copy_0, cards[i]));
|
Assert.That(csd.WritesPartialBlocks,
|
||||||
|
Is.EqualTo(write_partial_blocks[i]),
|
||||||
|
string.Format(Localization.Writes_partial_blocks_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(permanent_write_protect[i],
|
Assert.That(csd.FileFormatGroup,
|
||||||
csd.PermanentWriteProtect,
|
Is.EqualTo(file_format_group[i]),
|
||||||
string.Format(Localization.Permanent_write_protect_0, cards[i]));
|
string.Format(Localization.File_format_group_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(temporary_write_protect[i],
|
Assert.That(csd.Copy, Is.EqualTo(copy[i]), string.Format(Localization.Copy_0, cards[i]));
|
||||||
csd.TemporaryWriteProtect,
|
|
||||||
string.Format(Localization.Temporary_write_protect_0, cards[i]));
|
|
||||||
|
|
||||||
Assert.AreEqual(file_format[i],
|
Assert.That(csd.PermanentWriteProtect,
|
||||||
csd.FileFormat,
|
Is.EqualTo(permanent_write_protect[i]),
|
||||||
string.Format(Localization.File_format_0, cards[i]));
|
string.Format(Localization.Permanent_write_protect_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(ecc[i], csd.ECC, string.Format(Localization.ECC_0, cards[i]));
|
Assert.That(csd.TemporaryWriteProtect,
|
||||||
|
Is.EqualTo(temporary_write_protect[i]),
|
||||||
|
string.Format(Localization.Temporary_write_protect_0, cards[i]));
|
||||||
|
|
||||||
|
Assert.That(csd.FileFormat,
|
||||||
|
Is.EqualTo(file_format[i]),
|
||||||
|
string.Format(Localization.File_format_0, cards[i]));
|
||||||
|
|
||||||
|
Assert.That(csd.ECC, Is.EqualTo(ecc[i]), string.Format(Localization.ECC_0, cards[i]));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ public class ExtendedCSD
|
|||||||
for(var i = 0; i < _ecsd.Length; i++)
|
for(var i = 0; i < _ecsd.Length; i++)
|
||||||
{
|
{
|
||||||
Decoders.MMC.ExtendedCSD csd = Decoders.MMC.Decoders.DecodeExtendedCSD(_ecsd[i]);
|
Decoders.MMC.ExtendedCSD csd = Decoders.MMC.Decoders.DecodeExtendedCSD(_ecsd[i]);
|
||||||
Assert.IsNotNull(csd, string.Format(Localization.Not_decoded_0, i));
|
Assert.That(csd, Is.Not.Null, string.Format(Localization.Not_decoded_0, i));
|
||||||
csd.Should().BeEquivalentTo(_decoded[i]);
|
csd.Should().BeEquivalentTo(_decoded[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class PocketZip
|
|||||||
var image = new ZZZRawImage();
|
var image = new ZZZRawImage();
|
||||||
ErrorNumber opened = image.Open(filter);
|
ErrorNumber opened = image.Open(filter);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_0, _testFiles[i]));
|
Assert.That(opened, Is.EqualTo(ErrorNumber.NoError), string.Format(Localization.Open_0, _testFiles[i]));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) continue;
|
if(opened != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
@@ -73,17 +73,17 @@ public class PocketZip
|
|||||||
{
|
{
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.AreEqual(_sectors[i],
|
Assert.That(image.Info.Sectors,
|
||||||
image.Info.Sectors,
|
Is.EqualTo(_sectors[i]),
|
||||||
string.Format(Localization.Sectors_0, _testFiles[i]));
|
string.Format(Localization.Sectors_0, _testFiles[i]));
|
||||||
|
|
||||||
Assert.AreEqual(_sectorSize[i],
|
Assert.That(image.Info.SectorSize,
|
||||||
image.Info.SectorSize,
|
Is.EqualTo(_sectorSize[i]),
|
||||||
string.Format(Localization.Sector_size_0, _testFiles[i]));
|
string.Format(Localization.Sector_size_0, _testFiles[i]));
|
||||||
|
|
||||||
Assert.AreEqual(_mediaTypes[i],
|
Assert.That(image.Info.MediaType,
|
||||||
image.Info.MediaType,
|
Is.EqualTo(_mediaTypes[i]),
|
||||||
string.Format(Localization.Media_type_0, _testFiles[i]));
|
string.Format(Localization.Media_type_0, _testFiles[i]));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,33 +65,35 @@ public class CID
|
|||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
int count = Marshal.ConvertFromHexAscii(cids[i], out byte[] response);
|
int count = Marshal.ConvertFromHexAscii(cids[i], out byte[] response);
|
||||||
Assert.AreEqual(16, count, string.Format(Localization.Size_0, cards[i]));
|
Assert.That(count, Is.EqualTo(16), string.Format(Localization.Size_0, cards[i]));
|
||||||
Decoders.SecureDigital.CID cid = Decoders.SecureDigital.Decoders.DecodeCID(response);
|
Decoders.SecureDigital.CID cid = Decoders.SecureDigital.Decoders.DecodeCID(response);
|
||||||
Assert.IsNotNull(cid, string.Format(Localization.Decoded_0, cards[i]));
|
Assert.That(cid, Is.Not.Null, string.Format(Localization.Decoded_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(manufacturers[i],
|
Assert.That(cid.Manufacturer,
|
||||||
cid.Manufacturer,
|
Is.EqualTo(manufacturers[i]),
|
||||||
string.Format(Localization.Manufacturer_0, cards[i]));
|
string.Format(Localization.Manufacturer_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(applications[i],
|
Assert.That(cid.ApplicationID,
|
||||||
cid.ApplicationID,
|
Is.EqualTo(applications[i]),
|
||||||
string.Format(Localization.Application_ID_0, cards[i]));
|
string.Format(Localization.Application_ID_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(names[i], cid.ProductName, string.Format(Localization.Product_name_0, cards[i]));
|
Assert.That(cid.ProductName,
|
||||||
|
Is.EqualTo(names[i]),
|
||||||
|
string.Format(Localization.Product_name_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(revisions[i],
|
Assert.That(cid.ProductRevision,
|
||||||
cid.ProductRevision,
|
Is.EqualTo(revisions[i]),
|
||||||
string.Format(Localization.Product_revision_0, cards[i]));
|
string.Format(Localization.Product_revision_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(serials[i],
|
Assert.That(cid.ProductSerialNumber,
|
||||||
cid.ProductSerialNumber,
|
Is.EqualTo(serials[i]),
|
||||||
string.Format(Localization.Serial_number_0, cards[i]));
|
string.Format(Localization.Serial_number_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(dates[i],
|
Assert.That(cid.ManufacturingDate,
|
||||||
cid.ManufacturingDate,
|
Is.EqualTo(dates[i]),
|
||||||
string.Format(Localization.Manufacturing_date_0, cards[i]));
|
string.Format(Localization.Manufacturing_date_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(crcs[i], cid.CRC, string.Format(Localization.CRC_0, cards[i]));
|
Assert.That(cid.CRC, Is.EqualTo(crcs[i]), string.Format(Localization.CRC_0, cards[i]));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,98 +124,102 @@ public class CSD
|
|||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
int count = Marshal.ConvertFromHexAscii(csds[i], out byte[] response);
|
int count = Marshal.ConvertFromHexAscii(csds[i], out byte[] response);
|
||||||
Assert.AreEqual(16, count, string.Format(Localization.Size_0, cards[i]));
|
Assert.That(count, Is.EqualTo(16), string.Format(Localization.Size_0, cards[i]));
|
||||||
Decoders.SecureDigital.CSD csd = Decoders.SecureDigital.Decoders.DecodeCSD(response);
|
Decoders.SecureDigital.CSD csd = Decoders.SecureDigital.Decoders.DecodeCSD(response);
|
||||||
Assert.IsNotNull(csd, string.Format(Localization.Decoded_0, cards[i]));
|
Assert.That(csd, Is.Not.Null, string.Format(Localization.Decoded_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(structure_versions[i],
|
Assert.That(csd.Structure,
|
||||||
csd.Structure,
|
Is.EqualTo(structure_versions[i]),
|
||||||
string.Format(Localization.Version_0, cards[i]));
|
string.Format(Localization.Version_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(taacs[i], csd.TAAC, string.Format(Localization.TAAC_0, cards[i]));
|
Assert.That(csd.TAAC, Is.EqualTo(taacs[i]), string.Format(Localization.TAAC_0, cards[i]));
|
||||||
Assert.AreEqual(nsacs[i], csd.NSAC, string.Format(Localization.NSAC_0, cards[i]));
|
Assert.That(csd.NSAC, Is.EqualTo(nsacs[i]), string.Format(Localization.NSAC_0, cards[i]));
|
||||||
Assert.AreEqual(speeds[i], csd.Speed, string.Format(Localization.Transfer_speed_0, cards[i]));
|
|
||||||
Assert.AreEqual(classes[i], csd.Classes, string.Format(Localization.Classes_0, cards[i]));
|
|
||||||
|
|
||||||
Assert.AreEqual(read_block_lengths[i],
|
Assert.That(csd.Speed,
|
||||||
csd.ReadBlockLength,
|
Is.EqualTo(speeds[i]),
|
||||||
string.Format(Localization.Read_block_length_0, cards[i]));
|
string.Format(Localization.Transfer_speed_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(read_partial_blocks[i],
|
Assert.That(csd.Classes, Is.EqualTo(classes[i]), string.Format(Localization.Classes_0, cards[i]));
|
||||||
csd.ReadsPartialBlocks,
|
|
||||||
string.Format(Localization.Reads_partial_blocks_0, cards[i]));
|
|
||||||
|
|
||||||
Assert.AreEqual(write_misaligned_block[i],
|
Assert.That(csd.ReadBlockLength,
|
||||||
csd.WriteMisalignment,
|
Is.EqualTo(read_block_lengths[i]),
|
||||||
string.Format(Localization.Writes_misaligned_blocks_0, cards[i]));
|
string.Format(Localization.Read_block_length_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(read_misaligned_block[i],
|
Assert.That(csd.ReadsPartialBlocks,
|
||||||
csd.ReadMisalignment,
|
Is.EqualTo(read_partial_blocks[i]),
|
||||||
string.Format(Localization.Reads_misaligned_blocks_0, cards[i]));
|
string.Format(Localization.Reads_partial_blocks_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(dsr_implemented[i],
|
Assert.That(csd.WriteMisalignment,
|
||||||
csd.DSRImplemented,
|
Is.EqualTo(write_misaligned_block[i]),
|
||||||
string.Format(Localization.DSR_implemented_0, cards[i]));
|
string.Format(Localization.Writes_misaligned_blocks_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(card_sizes[i], csd.Size, string.Format(Localization.Card_size_0, cards[i]));
|
Assert.That(csd.ReadMisalignment,
|
||||||
|
Is.EqualTo(read_misaligned_block[i]),
|
||||||
|
string.Format(Localization.Reads_misaligned_blocks_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(min_read_current[i],
|
Assert.That(csd.DSRImplemented,
|
||||||
csd.ReadCurrentAtVddMin,
|
Is.EqualTo(dsr_implemented[i]),
|
||||||
string.Format(Localization.Reading_current_at_minimum_Vdd_0, cards[i]));
|
string.Format(Localization.DSR_implemented_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(max_read_current[i],
|
Assert.That(csd.Size, Is.EqualTo(card_sizes[i]), string.Format(Localization.Card_size_0, cards[i]));
|
||||||
csd.ReadCurrentAtVddMax,
|
|
||||||
string.Format(Localization.Reading_current_at_maximum_Vdd_0, cards[i]));
|
|
||||||
|
|
||||||
Assert.AreEqual(min_write_current[i],
|
Assert.That(csd.ReadCurrentAtVddMin,
|
||||||
csd.WriteCurrentAtVddMin,
|
Is.EqualTo(min_read_current[i]),
|
||||||
string.Format(Localization.Writing_current_at_minimum_Vdd_0, cards[i]));
|
string.Format(Localization.Reading_current_at_minimum_Vdd_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(max_write_current[i],
|
Assert.That(csd.ReadCurrentAtVddMax,
|
||||||
csd.WriteCurrentAtVddMax,
|
Is.EqualTo(max_read_current[i]),
|
||||||
string.Format(Localization.Writing_current_at_maximum_Vdd_0, cards[i]));
|
string.Format(Localization.Reading_current_at_maximum_Vdd_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(size_multiplier[i],
|
Assert.That(csd.WriteCurrentAtVddMin,
|
||||||
csd.SizeMultiplier,
|
Is.EqualTo(min_write_current[i]),
|
||||||
string.Format(Localization.Card_size_multiplier_0, cards[i]));
|
string.Format(Localization.Writing_current_at_minimum_Vdd_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(erase_block_enable[i],
|
Assert.That(csd.WriteCurrentAtVddMax,
|
||||||
csd.EraseBlockEnable,
|
Is.EqualTo(max_write_current[i]),
|
||||||
string.Format(Localization.Erase_block_enable_0, cards[i]));
|
string.Format(Localization.Writing_current_at_maximum_Vdd_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(erase_sector_sizes[i],
|
Assert.That(csd.SizeMultiplier,
|
||||||
csd.EraseSectorSize,
|
Is.EqualTo(size_multiplier[i]),
|
||||||
string.Format(Localization.Erase_sector_size_0, cards[i]));
|
string.Format(Localization.Card_size_multiplier_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(write_protect_group_size[i],
|
Assert.That(csd.EraseBlockEnable,
|
||||||
csd.WriteProtectGroupSize,
|
Is.EqualTo(erase_block_enable[i]),
|
||||||
string.Format(Localization.Write_protect_group_size_0, cards[i]));
|
string.Format(Localization.Erase_block_enable_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(write_protect_group_enable[i],
|
Assert.That(csd.EraseSectorSize,
|
||||||
csd.WriteProtectGroupEnable,
|
Is.EqualTo(erase_sector_sizes[i]),
|
||||||
string.Format(Localization.Write_protect_group_enable_0, cards[i]));
|
string.Format(Localization.Erase_sector_size_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(r2w_factors[i],
|
Assert.That(csd.WriteProtectGroupSize,
|
||||||
csd.WriteSpeedFactor,
|
Is.EqualTo(write_protect_group_size[i]),
|
||||||
string.Format(Localization.Read_to_write_factor_0, cards[i]));
|
string.Format(Localization.Write_protect_group_size_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(file_format_group[i],
|
Assert.That(csd.WriteProtectGroupEnable,
|
||||||
csd.FileFormatGroup,
|
Is.EqualTo(write_protect_group_enable[i]),
|
||||||
string.Format(Localization.File_format_group_0, cards[i]));
|
string.Format(Localization.Write_protect_group_enable_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(copy[i], csd.Copy, string.Format(Localization.Copy_0, cards[i]));
|
Assert.That(csd.WriteSpeedFactor,
|
||||||
|
Is.EqualTo(r2w_factors[i]),
|
||||||
|
string.Format(Localization.Read_to_write_factor_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(permanent_write_protect[i],
|
Assert.That(csd.FileFormatGroup,
|
||||||
csd.PermanentWriteProtect,
|
Is.EqualTo(file_format_group[i]),
|
||||||
string.Format(Localization.Permanent_write_protect_0, cards[i]));
|
string.Format(Localization.File_format_group_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(temporary_write_protect[i],
|
Assert.That(csd.Copy, Is.EqualTo(copy[i]), string.Format(Localization.Copy_0, cards[i]));
|
||||||
csd.TemporaryWriteProtect,
|
|
||||||
string.Format(Localization.Temporary_write_protect_0, cards[i]));
|
|
||||||
|
|
||||||
Assert.AreEqual(file_format[i],
|
Assert.That(csd.PermanentWriteProtect,
|
||||||
csd.FileFormat,
|
Is.EqualTo(permanent_write_protect[i]),
|
||||||
string.Format(Localization.File_format_0, cards[i]));
|
string.Format(Localization.Permanent_write_protect_0, cards[i]));
|
||||||
|
|
||||||
|
Assert.That(csd.TemporaryWriteProtect,
|
||||||
|
Is.EqualTo(temporary_write_protect[i]),
|
||||||
|
string.Format(Localization.Temporary_write_protect_0, cards[i]));
|
||||||
|
|
||||||
|
Assert.That(csd.FileFormat,
|
||||||
|
Is.EqualTo(file_format[i]),
|
||||||
|
string.Format(Localization.File_format_0, cards[i]));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,44 +71,46 @@ public class SCR
|
|||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
int count = Marshal.ConvertFromHexAscii(scrs[i], out byte[] response);
|
int count = Marshal.ConvertFromHexAscii(scrs[i], out byte[] response);
|
||||||
Assert.AreEqual(8, count, string.Format(Localization.Size_0, cards[i]));
|
Assert.That(count, Is.EqualTo(8), string.Format(Localization.Size_0, cards[i]));
|
||||||
Decoders.SecureDigital.SCR scr = Decoders.SecureDigital.Decoders.DecodeSCR(response);
|
Decoders.SecureDigital.SCR scr = Decoders.SecureDigital.Decoders.DecodeSCR(response);
|
||||||
Assert.IsNotNull(scr, string.Format(Localization.Decoded_0, cards[i]));
|
Assert.That(scr, Is.Not.Null, string.Format(Localization.Decoded_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(structure_version[i],
|
Assert.That(scr.Structure,
|
||||||
scr.Structure,
|
Is.EqualTo(structure_version[i]),
|
||||||
string.Format(Localization.Version_0, cards[i]));
|
string.Format(Localization.Version_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(specification_version[i],
|
Assert.That(scr.Spec,
|
||||||
scr.Spec,
|
Is.EqualTo(specification_version[i]),
|
||||||
string.Format(Localization.Specification_version_0, cards[i]));
|
string.Format(Localization.Specification_version_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(data_stat_after_erase[i],
|
Assert.That(scr.DataStatusAfterErase,
|
||||||
scr.DataStatusAfterErase,
|
Is.EqualTo(data_stat_after_erase[i]),
|
||||||
string.Format(Localization.Data_stat_after_erase_0, cards[i]));
|
string.Format(Localization.Data_stat_after_erase_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(sd_security[i], scr.Security, string.Format(Localization.Security_0, cards[i]));
|
Assert.That(scr.Security,
|
||||||
|
Is.EqualTo(sd_security[i]),
|
||||||
|
string.Format(Localization.Security_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual((BusWidth)sd_bus_widths[i],
|
Assert.That(scr.BusWidth,
|
||||||
scr.BusWidth,
|
Is.EqualTo((BusWidth)sd_bus_widths[i]),
|
||||||
string.Format(Localization.Bus_widths_0, cards[i]));
|
string.Format(Localization.Bus_widths_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(sd_spec3[i], scr.Spec3, string.Format(Localization.Spec_3_0, cards[i]));
|
Assert.That(scr.Spec3, Is.EqualTo(sd_spec3[i]), string.Format(Localization.Spec_3_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(ex_security[i],
|
Assert.That(scr.ExtendedSecurity,
|
||||||
scr.ExtendedSecurity,
|
Is.EqualTo(ex_security[i]),
|
||||||
string.Format(Localization.Extended_security_0, cards[i]));
|
string.Format(Localization.Extended_security_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(sd_spec4[i], scr.Spec4, string.Format(Localization.Spec_4_0, cards[i]));
|
Assert.That(scr.Spec4, Is.EqualTo(sd_spec4[i]), string.Format(Localization.Spec_4_0, cards[i]));
|
||||||
Assert.AreEqual(sd_specx[i], scr.SpecX, string.Format(Localization.Spec_X_0, cards[i]));
|
Assert.That(scr.SpecX, Is.EqualTo(sd_specx[i]), string.Format(Localization.Spec_X_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual((CommandSupport)cmd_support[i],
|
Assert.That(scr.CommandSupport,
|
||||||
scr.CommandSupport,
|
Is.EqualTo((CommandSupport)cmd_support[i]),
|
||||||
string.Format(Localization.Command_support_0, cards[i]));
|
string.Format(Localization.Command_support_0, cards[i]));
|
||||||
|
|
||||||
Assert.AreEqual(mfg[i],
|
Assert.That(scr.ManufacturerReserved,
|
||||||
scr.ManufacturerReserved,
|
Is.EqualTo(mfg[i]),
|
||||||
string.Format(Localization.Manufacturer_reserved_0, cards[i]));
|
string.Format(Localization.Manufacturer_reserved_0, cards[i]));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public abstract class FilesystemTest(string fileSystemType)
|
|||||||
string testFile = test.TestFile;
|
string testFile = test.TestFile;
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -45,15 +45,15 @@ public abstract class FilesystemTest(string fileSystemType)
|
|||||||
|
|
||||||
IFilter inputFilter = PluginRegister.Singleton.GetFilter(testFile);
|
IFilter inputFilter = PluginRegister.Singleton.GetFilter(testFile);
|
||||||
|
|
||||||
Assert.IsNotNull(inputFilter, string.Format(Localization.Filter_0, testFile));
|
Assert.That(inputFilter, Is.Not.Null, string.Format(Localization.Filter_0, testFile));
|
||||||
|
|
||||||
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
|
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
|
||||||
|
|
||||||
Assert.IsNotNull(image, string.Format(Localization.Image_format_0, testFile));
|
Assert.That(image, Is.Not.Null, string.Format(Localization.Image_format_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(image.Open(inputFilter),
|
||||||
image.Open(inputFilter),
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Cannot_open_image_for_0, testFile));
|
string.Format(Localization.Cannot_open_image_for_0, testFile));
|
||||||
|
|
||||||
List<string> idPlugins;
|
List<string> idPlugins;
|
||||||
|
|
||||||
@@ -61,9 +61,9 @@ public abstract class FilesystemTest(string fileSystemType)
|
|||||||
{
|
{
|
||||||
List<Partition> partitionsList = Core.Partitions.GetAll(image);
|
List<Partition> partitionsList = Core.Partitions.GetAll(image);
|
||||||
|
|
||||||
Assert.Greater(partitionsList.Count,
|
Assert.That(partitionsList,
|
||||||
0,
|
Is.Not.Empty,
|
||||||
string.Format(Localization.No_partitions_found_for_0, testFile));
|
string.Format(Localization.No_partitions_found_for_0, testFile));
|
||||||
|
|
||||||
var found = false;
|
var found = false;
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ public abstract class FilesystemTest(string fileSystemType)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.True(found, string.Format(Localization.Filesystem_not_identified_for_0, testFile));
|
Assert.That(found, string.Format(Localization.Filesystem_not_identified_for_0, testFile));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -93,11 +93,12 @@ public abstract class FilesystemTest(string fileSystemType)
|
|||||||
|
|
||||||
Core.Filesystems.Identify(image, out idPlugins, wholePart, true);
|
Core.Filesystems.Identify(image, out idPlugins, wholePart, true);
|
||||||
|
|
||||||
Assert.Greater(idPlugins.Count,
|
Assert.That(idPlugins,
|
||||||
0,
|
Is.Not.Empty,
|
||||||
string.Format(Localization.No_filesystems_found_for_0, testFile));
|
string.Format(Localization.No_filesystems_found_for_0, testFile));
|
||||||
|
|
||||||
Assert.True(idPlugins.Contains(Plugin.Id.ToString()),
|
Assert.That(idPlugins,
|
||||||
|
Does.Contain(Plugin.Id.ToString()),
|
||||||
string.Format(Localization.Not_identified_for_0, testFile));
|
string.Format(Localization.Not_identified_for_0, testFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,7 +117,7 @@ public abstract class FilesystemTest(string fileSystemType)
|
|||||||
string testFile = test.TestFile;
|
string testFile = test.TestFile;
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -124,19 +125,19 @@ public abstract class FilesystemTest(string fileSystemType)
|
|||||||
|
|
||||||
IFilter inputFilter = PluginRegister.Singleton.GetFilter(testFile);
|
IFilter inputFilter = PluginRegister.Singleton.GetFilter(testFile);
|
||||||
|
|
||||||
Assert.IsNotNull(inputFilter, string.Format(Localization.Filter_0, testFile));
|
Assert.That(inputFilter, Is.Not.Null, string.Format(Localization.Filter_0, testFile));
|
||||||
|
|
||||||
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
|
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
|
||||||
|
|
||||||
Assert.IsNotNull(image, string.Format(Localization.Image_format_0, testFile));
|
Assert.That(image, Is.Not.Null, string.Format(Localization.Image_format_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(image.Open(inputFilter),
|
||||||
image.Open(inputFilter),
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Cannot_open_image_for_0, testFile));
|
string.Format(Localization.Cannot_open_image_for_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(test.MediaType, image.Info.MediaType, testFile);
|
Assert.That(image.Info.MediaType, Is.EqualTo(test.MediaType), testFile);
|
||||||
Assert.AreEqual(test.Sectors, image.Info.Sectors, testFile);
|
Assert.That(image.Info.Sectors, Is.EqualTo(test.Sectors), testFile);
|
||||||
Assert.AreEqual(test.SectorSize, image.Info.SectorSize, testFile);
|
Assert.That(image.Info.SectorSize, Is.EqualTo(test.SectorSize), testFile);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -155,7 +156,7 @@ public abstract class FilesystemTest(string fileSystemType)
|
|||||||
var partition = new Partition();
|
var partition = new Partition();
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -163,15 +164,15 @@ public abstract class FilesystemTest(string fileSystemType)
|
|||||||
|
|
||||||
IFilter inputFilter = PluginRegister.Singleton.GetFilter(testFile);
|
IFilter inputFilter = PluginRegister.Singleton.GetFilter(testFile);
|
||||||
|
|
||||||
Assert.IsNotNull(inputFilter, string.Format(Localization.Filter_0, testFile));
|
Assert.That(inputFilter, Is.Not.Null, string.Format(Localization.Filter_0, testFile));
|
||||||
|
|
||||||
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
|
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
|
||||||
|
|
||||||
Assert.IsNotNull(image, string.Format(Localization.Image_format_0, testFile));
|
Assert.That(image, Is.Not.Null, string.Format(Localization.Image_format_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(image.Open(inputFilter),
|
||||||
image.Open(inputFilter),
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Cannot_open_image_for_0, testFile));
|
string.Format(Localization.Cannot_open_image_for_0, testFile));
|
||||||
|
|
||||||
List<string> idPlugins;
|
List<string> idPlugins;
|
||||||
|
|
||||||
@@ -179,9 +180,9 @@ public abstract class FilesystemTest(string fileSystemType)
|
|||||||
{
|
{
|
||||||
List<Partition> partitionsList = Core.Partitions.GetAll(image);
|
List<Partition> partitionsList = Core.Partitions.GetAll(image);
|
||||||
|
|
||||||
Assert.Greater(partitionsList.Count,
|
Assert.That(partitionsList,
|
||||||
0,
|
Is.Not.Empty,
|
||||||
string.Format(Localization.No_partitions_found_for_0, testFile));
|
string.Format(Localization.No_partitions_found_for_0, testFile));
|
||||||
|
|
||||||
// In reverse to skip boot partitions we're not interested in
|
// In reverse to skip boot partitions we're not interested in
|
||||||
for(int index = partitionsList.Count - 1; index >= 0; index--)
|
for(int index = partitionsList.Count - 1; index >= 0; index--)
|
||||||
@@ -209,14 +210,14 @@ public abstract class FilesystemTest(string fileSystemType)
|
|||||||
|
|
||||||
Core.Filesystems.Identify(image, out idPlugins, partition, true);
|
Core.Filesystems.Identify(image, out idPlugins, partition, true);
|
||||||
|
|
||||||
Assert.Greater(idPlugins.Count,
|
Assert.That(idPlugins,
|
||||||
0,
|
Is.Not.Empty,
|
||||||
string.Format(Localization.No_filesystems_found_for_0, testFile));
|
string.Format(Localization.No_filesystems_found_for_0, testFile));
|
||||||
|
|
||||||
found = idPlugins.Contains(Plugin.Id.ToString());
|
found = idPlugins.Contains(Plugin.Id.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.True(found, string.Format(Localization.Filesystem_not_identified_for_0, testFile));
|
Assert.That(found, string.Format(Localization.Filesystem_not_identified_for_0, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It is not the case, it changes
|
// It is not the case, it changes
|
||||||
@@ -224,42 +225,49 @@ public abstract class FilesystemTest(string fileSystemType)
|
|||||||
|
|
||||||
var fs = Activator.CreateInstance(Plugin.GetType()) as IFilesystem;
|
var fs = Activator.CreateInstance(Plugin.GetType()) as IFilesystem;
|
||||||
|
|
||||||
Assert.NotNull(fs, string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
Assert.That(fs,
|
||||||
|
Is.Not.Null,
|
||||||
|
string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
||||||
|
|
||||||
fs.GetInformation(image, partition, null, out _, out FileSystem fsMetadata);
|
fs.GetInformation(image, partition, null, out _, out FileSystem fsMetadata);
|
||||||
|
|
||||||
if(test.ApplicationId != null)
|
if(test.ApplicationId != null)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(test.ApplicationId,
|
Assert.That(fsMetadata.ApplicationIdentifier,
|
||||||
fsMetadata.ApplicationIdentifier,
|
Is.EqualTo(test.ApplicationId),
|
||||||
string.Format(Localization.Application_ID_0, testFile));
|
string.Format(Localization.Application_ID_0, testFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(test.Bootable, fsMetadata.Bootable, string.Format(Localization.Bootable_0, testFile));
|
Assert.That(fsMetadata.Bootable,
|
||||||
Assert.AreEqual(test.Clusters, fsMetadata.Clusters, string.Format(Localization.Clusters_0, testFile));
|
Is.EqualTo(test.Bootable),
|
||||||
|
string.Format(Localization.Bootable_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(test.ClusterSize,
|
Assert.That(fsMetadata.Clusters,
|
||||||
fsMetadata.ClusterSize,
|
Is.EqualTo(test.Clusters),
|
||||||
string.Format(Localization.Cluster_size_0, testFile));
|
string.Format(Localization.Clusters_0, testFile));
|
||||||
|
|
||||||
|
Assert.That(fsMetadata.ClusterSize,
|
||||||
|
Is.EqualTo(test.ClusterSize),
|
||||||
|
string.Format(Localization.Cluster_size_0, testFile));
|
||||||
|
|
||||||
if(test.SystemId != null)
|
if(test.SystemId != null)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(test.SystemId,
|
Assert.That(fsMetadata.SystemIdentifier,
|
||||||
fsMetadata.SystemIdentifier,
|
Is.EqualTo(test.SystemId),
|
||||||
string.Format(Localization.System_ID_0, testFile));
|
string.Format(Localization.System_ID_0, testFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(fileSystemType ?? test.Type,
|
Assert.That(fsMetadata.Type,
|
||||||
fsMetadata.Type,
|
Is.EqualTo(fileSystemType ?? test.Type),
|
||||||
string.Format(Localization.Filesystem_type_0, testFile));
|
string.Format(Localization.Filesystem_type_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(test.VolumeName,
|
Assert.That(fsMetadata.VolumeName,
|
||||||
fsMetadata.VolumeName,
|
Is.EqualTo(test.VolumeName),
|
||||||
string.Format(Localization.Volume_name_0, testFile));
|
string.Format(Localization.Volume_name_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(test.VolumeSerial,
|
Assert.That(fsMetadata.VolumeSerial,
|
||||||
fsMetadata.VolumeSerial,
|
Is.EqualTo(test.VolumeSerial),
|
||||||
string.Format(Localization.Volume_serial_0, testFile));
|
string.Format(Localization.Volume_serial_0, testFile));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
|
|||||||
var partition = new Partition();
|
var partition = new Partition();
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -44,15 +44,15 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
|
|||||||
|
|
||||||
IFilter inputFilter = PluginRegister.Singleton.GetFilter(testFile);
|
IFilter inputFilter = PluginRegister.Singleton.GetFilter(testFile);
|
||||||
|
|
||||||
Assert.IsNotNull(inputFilter, string.Format(Localization.Filter_0, testFile));
|
Assert.That(inputFilter, Is.Not.Null, string.Format(Localization.Filter_0, testFile));
|
||||||
|
|
||||||
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
|
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
|
||||||
|
|
||||||
Assert.IsNotNull(image, string.Format(Localization.Image_format_0, testFile));
|
Assert.That(image, Is.Not.Null, string.Format(Localization.Image_format_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(image.Open(inputFilter),
|
||||||
image.Open(inputFilter),
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Cannot_open_image_for_0, testFile));
|
string.Format(Localization.Cannot_open_image_for_0, testFile));
|
||||||
|
|
||||||
List<string> idPlugins;
|
List<string> idPlugins;
|
||||||
|
|
||||||
@@ -60,9 +60,9 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
|
|||||||
{
|
{
|
||||||
List<Partition> partitionsList = Core.Partitions.GetAll(image);
|
List<Partition> partitionsList = Core.Partitions.GetAll(image);
|
||||||
|
|
||||||
Assert.Greater(partitionsList.Count,
|
Assert.That(partitionsList,
|
||||||
0,
|
Is.Not.Empty,
|
||||||
string.Format(Localization.No_partitions_found_for_0, testFile));
|
string.Format(Localization.No_partitions_found_for_0, testFile));
|
||||||
|
|
||||||
// In reverse to skip boot partitions we're not interested in
|
// In reverse to skip boot partitions we're not interested in
|
||||||
for(int index = partitionsList.Count - 1; index >= 0; index--)
|
for(int index = partitionsList.Count - 1; index >= 0; index--)
|
||||||
@@ -90,14 +90,14 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
|
|||||||
|
|
||||||
Core.Filesystems.Identify(image, out idPlugins, partition, true);
|
Core.Filesystems.Identify(image, out idPlugins, partition, true);
|
||||||
|
|
||||||
Assert.Greater(idPlugins.Count,
|
Assert.That(idPlugins,
|
||||||
0,
|
Is.Not.Empty,
|
||||||
string.Format(Localization.No_filesystems_found_for_0, testFile));
|
string.Format(Localization.No_filesystems_found_for_0, testFile));
|
||||||
|
|
||||||
found = idPlugins.Contains(Plugin.Id.ToString());
|
found = idPlugins.Contains(Plugin.Id.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.True(found, string.Format(Localization.Filesystem_not_identified_for_0, testFile));
|
Assert.That(found, string.Format(Localization.Filesystem_not_identified_for_0, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It is not the case, it changes
|
// It is not the case, it changes
|
||||||
@@ -105,13 +105,15 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
|
|||||||
|
|
||||||
var fs = Activator.CreateInstance(Plugin.GetType()) as IReadOnlyFilesystem;
|
var fs = Activator.CreateInstance(Plugin.GetType()) as IReadOnlyFilesystem;
|
||||||
|
|
||||||
Assert.NotNull(fs, string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
Assert.That(fs,
|
||||||
|
Is.Not.Null,
|
||||||
|
string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
||||||
|
|
||||||
test.Encoding ??= Encoding.ASCII;
|
test.Encoding ??= Encoding.ASCII;
|
||||||
|
|
||||||
ErrorNumber ret = fs.Mount(image, partition, test.Encoding, null, test.Namespace);
|
ErrorNumber ret = fs.Mount(image, partition, test.Encoding, null, test.Namespace);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, ret, string.Format(Localization.Unmountable_0, testFile));
|
Assert.That(ret, Is.EqualTo(ErrorNumber.NoError), string.Format(Localization.Unmountable_0, testFile));
|
||||||
|
|
||||||
var serializerOptions = new JsonSerializerOptions
|
var serializerOptions = new JsonSerializerOptions
|
||||||
{
|
{
|
||||||
@@ -349,12 +351,9 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
|
|||||||
// Directory is not readable, probably filled the volume, just ignore it
|
// Directory is not readable, probably filled the volume, just ignore it
|
||||||
if(ret == ErrorNumber.InvalidArgument) return;
|
if(ret == ErrorNumber.InvalidArgument) return;
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(ret,
|
||||||
ret,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Unexpected_error_0_when_reading_directory_1_of_2,
|
string.Format(Localization.Unexpected_error_0_when_reading_directory_1_of_2, ret, path, testFile));
|
||||||
ret,
|
|
||||||
path,
|
|
||||||
testFile));
|
|
||||||
|
|
||||||
if(ret != ErrorNumber.NoError) return;
|
if(ret != ErrorNumber.NoError) return;
|
||||||
|
|
||||||
@@ -387,12 +386,12 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
|
|||||||
|
|
||||||
contents.Remove(child.Key);
|
contents.Remove(child.Key);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(ret,
|
||||||
ret,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Unexpected_error_0_retrieving_stats_for_1_in_2,
|
string.Format(Localization.Unexpected_error_0_retrieving_stats_for_1_in_2,
|
||||||
ret,
|
ret,
|
||||||
childPath,
|
childPath,
|
||||||
testFile));
|
testFile));
|
||||||
|
|
||||||
if(child.Value.Info is not null)
|
if(child.Value.Info is not null)
|
||||||
{
|
{
|
||||||
@@ -437,18 +436,18 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
|
|||||||
{
|
{
|
||||||
ret = fs.OpenFile(childPath, out _);
|
ret = fs.OpenFile(childPath, out _);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.IsDirectory,
|
Assert.That(ret,
|
||||||
ret,
|
Is.EqualTo(ErrorNumber.IsDirectory),
|
||||||
string.Format(Localization.Got_wrong_data_for_directory_0_in_1, childPath, testFile));
|
string.Format(Localization.Got_wrong_data_for_directory_0_in_1, childPath, testFile));
|
||||||
|
|
||||||
// Cannot serialize to JSON too many depth levels 🤷♀️
|
// Cannot serialize to JSON too many depth levels 🤷♀️
|
||||||
if(currentDepth < 384)
|
if(currentDepth < 384)
|
||||||
{
|
{
|
||||||
Assert.IsNotNull(child.Value.Children,
|
Assert.That(child.Value.Children,
|
||||||
string.Format(Localization
|
Is.Not.Null,
|
||||||
.Contents_for_0_in_1_must_be_defined_in_unit_test_declaration,
|
string.Format(Localization.Contents_for_0_in_1_must_be_defined_in_unit_test_declaration,
|
||||||
childPath,
|
childPath,
|
||||||
testFile));
|
testFile));
|
||||||
|
|
||||||
if(child.Value.Children != null)
|
if(child.Value.Children != null)
|
||||||
{
|
{
|
||||||
@@ -462,17 +461,13 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
|
|||||||
{
|
{
|
||||||
ret = fs.ReadLink(childPath, out string link);
|
ret = fs.ReadLink(childPath, out string link);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(ret,
|
||||||
ret,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Got_wrong_data_for_symbolic_link_0_in_1,
|
string.Format(Localization.Got_wrong_data_for_symbolic_link_0_in_1, childPath, testFile));
|
||||||
childPath,
|
|
||||||
testFile));
|
|
||||||
|
|
||||||
Assert.AreEqual(child.Value.LinkTarget,
|
Assert.That(link,
|
||||||
link,
|
Is.EqualTo(child.Value.LinkTarget),
|
||||||
string.Format(Localization.Invalid_target_for_symbolic_link_0_in_1,
|
string.Format(Localization.Invalid_target_for_symbolic_link_0_in_1, childPath, testFile));
|
||||||
childPath,
|
|
||||||
testFile));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -485,48 +480,52 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
|
|||||||
|
|
||||||
if(ret == ErrorNumber.NotSupported)
|
if(ret == ErrorNumber.NotSupported)
|
||||||
{
|
{
|
||||||
Assert.IsNull(child.Value.XattrsWithMd5,
|
Assert.That(child.Value.XattrsWithMd5,
|
||||||
string.Format(Localization
|
Is.Null,
|
||||||
.Defined_extended_attributes_for_0_in_1_are_not_supported_by_filesystem,
|
string.Format(Localization
|
||||||
childPath,
|
.Defined_extended_attributes_for_0_in_1_are_not_supported_by_filesystem,
|
||||||
testFile));
|
childPath,
|
||||||
|
testFile));
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(ret,
|
||||||
ret,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Unexpected_error_0_when_listing_extended_attributes_for_1_in_2,
|
string.Format(Localization.Unexpected_error_0_when_listing_extended_attributes_for_1_in_2,
|
||||||
ret,
|
ret,
|
||||||
childPath,
|
childPath,
|
||||||
testFile));
|
testFile));
|
||||||
|
|
||||||
if(xattrs.Count > 0)
|
if(xattrs.Count > 0)
|
||||||
{
|
{
|
||||||
Assert.IsNotNull(child.Value.XattrsWithMd5,
|
Assert.That(child.Value.XattrsWithMd5,
|
||||||
string.Format(Localization
|
Is.Not.Null,
|
||||||
.Extended_attributes_for_0_in_1_must_be_defined_in_unit_test_declaration,
|
string.Format(Localization
|
||||||
childPath,
|
.Extended_attributes_for_0_in_1_must_be_defined_in_unit_test_declaration,
|
||||||
testFile));
|
childPath,
|
||||||
|
testFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(xattrs.Count > 0 || child.Value.XattrsWithMd5?.Count > 0)
|
if(xattrs.Count > 0 || child.Value.XattrsWithMd5?.Count > 0)
|
||||||
TestFileXattrs(fs, childPath, child.Value.XattrsWithMd5, testFile);
|
TestFileXattrs(fs, childPath, child.Value.XattrsWithMd5, testFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsEmpty(expectedNotFound,
|
Assert.That(expectedNotFound,
|
||||||
string.Format(Localization.Could_not_find_the_children_of_0_in_1_2,
|
Is.Empty,
|
||||||
path,
|
string.Format(Localization.Could_not_find_the_children_of_0_in_1_2,
|
||||||
testFile,
|
path,
|
||||||
string.Join(" ", expectedNotFound)));
|
testFile,
|
||||||
|
string.Join(" ", expectedNotFound)));
|
||||||
|
|
||||||
if(contents != null)
|
if(contents != null)
|
||||||
{
|
{
|
||||||
Assert.IsEmpty(contents,
|
Assert.That(contents,
|
||||||
string.Format(Localization.Found_the_following_unexpected_children_of_0_in_1_2,
|
Is.Empty,
|
||||||
path,
|
string.Format(Localization.Found_the_following_unexpected_children_of_0_in_1_2,
|
||||||
testFile,
|
path,
|
||||||
string.Join(" ", contents)));
|
testFile,
|
||||||
|
string.Join(" ", contents)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -535,31 +534,31 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
|
|||||||
var buffer = new byte[length];
|
var buffer = new byte[length];
|
||||||
ErrorNumber ret = fs.OpenFile(path, out IFileNode fileNode);
|
ErrorNumber ret = fs.OpenFile(path, out IFileNode fileNode);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(ret,
|
||||||
ret,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Unexpected_error_0_when_reading_1_in_2, ret, path, testFile));
|
string.Format(Localization.Unexpected_error_0_when_reading_1_in_2, ret, path, testFile));
|
||||||
|
|
||||||
ret = fs.ReadFile(fileNode, length, buffer, out long readBytes);
|
ret = fs.ReadFile(fileNode, length, buffer, out long readBytes);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(ret,
|
||||||
ret,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Unexpected_error_0_when_reading_1_in_2, ret, path, testFile));
|
string.Format(Localization.Unexpected_error_0_when_reading_1_in_2, ret, path, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(length,
|
Assert.That(readBytes,
|
||||||
readBytes,
|
Is.EqualTo(length),
|
||||||
string.Format(Localization.Got_less_bytes_0_than_expected_1_when_reading_2_in_3,
|
string.Format(Localization.Got_less_bytes_0_than_expected_1_when_reading_2_in_3,
|
||||||
readBytes,
|
readBytes,
|
||||||
length,
|
length,
|
||||||
path,
|
path,
|
||||||
testFile));
|
testFile));
|
||||||
|
|
||||||
fs.CloseFile(fileNode);
|
fs.CloseFile(fileNode);
|
||||||
|
|
||||||
string data = Md5Context.Data(buffer, out _);
|
string data = Md5Context.Data(buffer, out _);
|
||||||
|
|
||||||
Assert.AreEqual(md5,
|
Assert.That(data,
|
||||||
data,
|
Is.EqualTo(md5),
|
||||||
string.Format(Localization.Got_MD5_0_for_1_in_2_but_expected_3, data, path, testFile, md5));
|
string.Format(Localization.Got_MD5_0_for_1_in_2_but_expected_3, data, path, testFile, md5));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TestFileXattrs(IReadOnlyFilesystem fs, string path, Dictionary<string, string> xattrs, string testFile)
|
static void TestFileXattrs(IReadOnlyFilesystem fs, string path, Dictionary<string, string> xattrs, string testFile)
|
||||||
@@ -590,37 +589,39 @@ public abstract class ReadOnlyFilesystemTest : FilesystemTest
|
|||||||
// Partially read extended attribute... dunno why it happens with some Toast images
|
// Partially read extended attribute... dunno why it happens with some Toast images
|
||||||
if(ret != ErrorNumber.OutOfRange)
|
if(ret != ErrorNumber.OutOfRange)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(ret,
|
||||||
ret,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Unexpected_error_0_retrieving_extended_attributes_for_1_in_2,
|
string.Format(Localization.Unexpected_error_0_retrieving_extended_attributes_for_1_in_2,
|
||||||
ret,
|
ret,
|
||||||
path,
|
path,
|
||||||
testFile));
|
testFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
string data = Md5Context.Data(buffer, out _);
|
string data = Md5Context.Data(buffer, out _);
|
||||||
|
|
||||||
Assert.AreEqual(xattr.Value,
|
Assert.That(data,
|
||||||
data,
|
Is.EqualTo(xattr.Value),
|
||||||
string.Format(Localization.Got_MD5_0_for_1_of_2_in_3_but_expected_4,
|
string.Format(Localization.Got_MD5_0_for_1_of_2_in_3_but_expected_4,
|
||||||
data,
|
data,
|
||||||
xattr.Key,
|
xattr.Key,
|
||||||
path,
|
path,
|
||||||
testFile,
|
testFile,
|
||||||
xattr.Value));
|
xattr.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsEmpty(expectedNotFound,
|
Assert.That(expectedNotFound,
|
||||||
string.Format(Localization.Could_not_find_the_following_extended_attributes_of_0_in_1_2,
|
Is.Empty,
|
||||||
path,
|
string.Format(Localization.Could_not_find_the_following_extended_attributes_of_0_in_1_2,
|
||||||
testFile,
|
path,
|
||||||
string.Join(" ", expectedNotFound)));
|
testFile,
|
||||||
|
string.Join(" ", expectedNotFound)));
|
||||||
|
|
||||||
Assert.IsEmpty(contents,
|
Assert.That(contents,
|
||||||
string.Format(Localization.Found_the_following_unexpected_extended_attributes_of_0_in_1_2,
|
Is.Empty,
|
||||||
path,
|
string.Format(Localization.Found_the_following_unexpected_extended_attributes_of_0_in_1_2,
|
||||||
testFile,
|
path,
|
||||||
string.Join(" ", contents)));
|
testFile,
|
||||||
|
string.Join(" ", contents)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Nested type: NextLevel
|
#region Nested type: NextLevel
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// /***************************************************************************
|
// /***************************************************************************
|
||||||
// Aaru Data Preservation Suite
|
// Aaru Data Preservation Suite
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
@@ -65,24 +65,24 @@ public class AppleDoubleDave
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_CONTENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
string result = Md5Context.File(_location, out _);
|
string result = Md5Context.File(_location, out _);
|
||||||
Assert.AreEqual(EXPECTED_FILE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_FILE));
|
||||||
|
|
||||||
result = Md5Context.File(_sidecar, out _);
|
result = Md5Context.File(_sidecar, out _);
|
||||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_SIDECAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new AppleDouble();
|
IFilter filter = new AppleDouble();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -97,19 +97,19 @@ public class AppleDoubleDave
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_RESOURCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new AppleDouble();
|
IFilter filter = new AppleDouble();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(737280, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(737280));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(286, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(286));
|
||||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(true, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.True);
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,24 +64,24 @@ public class AppleDoubleDos
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_CONTENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
string result = Md5Context.File(_location, out _);
|
string result = Md5Context.File(_location, out _);
|
||||||
Assert.AreEqual(EXPECTED_FILE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_FILE));
|
||||||
|
|
||||||
result = Md5Context.File(_sidecar, out _);
|
result = Md5Context.File(_sidecar, out _);
|
||||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_SIDECAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new AppleDouble();
|
IFilter filter = new AppleDouble();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -96,19 +96,19 @@ public class AppleDoubleDos
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_RESOURCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new AppleDouble();
|
IFilter filter = new AppleDouble();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(737280, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(737280));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(286, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(286));
|
||||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(true, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.True);
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,24 +70,24 @@ public class AppleDoubleNetatalk
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_CONTENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
string result = Md5Context.File(_location, out _);
|
string result = Md5Context.File(_location, out _);
|
||||||
Assert.AreEqual(EXPECTED_FILE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_FILE));
|
||||||
|
|
||||||
result = Md5Context.File(_sidecar, out _);
|
result = Md5Context.File(_sidecar, out _);
|
||||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_SIDECAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new AppleDouble();
|
IFilter filter = new AppleDouble();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -102,19 +102,19 @@ public class AppleDoubleNetatalk
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_RESOURCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new AppleDouble();
|
IFilter filter = new AppleDouble();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(737280, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(737280));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(286, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(286));
|
||||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(true, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.True);
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,24 +64,24 @@ public class AppleDoubleOsX
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_CONTENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
string result = Md5Context.File(_location, out _);
|
string result = Md5Context.File(_location, out _);
|
||||||
Assert.AreEqual(EXPECTED_FILE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_FILE));
|
||||||
|
|
||||||
result = Md5Context.File(_sidecar, out _);
|
result = Md5Context.File(_sidecar, out _);
|
||||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_SIDECAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new AppleDouble();
|
IFilter filter = new AppleDouble();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -96,19 +96,19 @@ public class AppleDoubleOsX
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_RESOURCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new AppleDouble();
|
IFilter filter = new AppleDouble();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(737280, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(737280));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(286, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(286));
|
||||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(true, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.True);
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,24 +64,24 @@ public class AppleDoubleProDos
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_CONTENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
string result = Md5Context.File(_location, out _);
|
string result = Md5Context.File(_location, out _);
|
||||||
Assert.AreEqual(EXPECTED_FILE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_FILE));
|
||||||
|
|
||||||
result = Md5Context.File(_sidecar, out _);
|
result = Md5Context.File(_sidecar, out _);
|
||||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_SIDECAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new AppleDouble();
|
IFilter filter = new AppleDouble();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -96,19 +96,19 @@ public class AppleDoubleProDos
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_RESOURCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new AppleDouble();
|
IFilter filter = new AppleDouble();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(737280, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(737280));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(286, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(286));
|
||||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(true, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.True);
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,24 +64,24 @@ public class AppleDoubleUnAr
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_CONTENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
string result = Md5Context.File(_location, out _);
|
string result = Md5Context.File(_location, out _);
|
||||||
Assert.AreEqual(EXPECTED_FILE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_FILE));
|
||||||
|
|
||||||
result = Md5Context.File(_sidecar, out _);
|
result = Md5Context.File(_sidecar, out _);
|
||||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_SIDECAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new AppleDouble();
|
IFilter filter = new AppleDouble();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -96,19 +96,19 @@ public class AppleDoubleUnAr
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_RESOURCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new AppleDouble();
|
IFilter filter = new AppleDouble();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(737280, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(737280));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(286, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(286));
|
||||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(true, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.True);
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,24 +64,24 @@ public class AppleDoubleUnix
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_CONTENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
string result = Md5Context.File(_location, out _);
|
string result = Md5Context.File(_location, out _);
|
||||||
Assert.AreEqual(EXPECTED_FILE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_FILE));
|
||||||
|
|
||||||
result = Md5Context.File(_sidecar, out _);
|
result = Md5Context.File(_sidecar, out _);
|
||||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_SIDECAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new AppleDouble();
|
IFilter filter = new AppleDouble();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -96,19 +96,19 @@ public class AppleDoubleUnix
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_RESOURCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new AppleDouble();
|
IFilter filter = new AppleDouble();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(737280, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(737280));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(286, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(286));
|
||||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(true, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.True);
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,21 +57,21 @@ public class AppleSingle
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_CONTENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
string result = Md5Context.File(_location, out _);
|
string result = Md5Context.File(_location, out _);
|
||||||
Assert.AreEqual(EXPECTED_FILE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_FILE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new Aaru.Filters.AppleSingle();
|
IFilter filter = new Aaru.Filters.AppleSingle();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -86,19 +86,19 @@ public class AppleSingle
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_RESOURCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new Aaru.Filters.AppleSingle();
|
IFilter filter = new Aaru.Filters.AppleSingle();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(737280, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(737280));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(286, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(286));
|
||||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(true, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.True);
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,33 +62,33 @@ public class BZip2
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
Md5Context.Data(data, out byte[] result);
|
Md5Context.Data(data, out byte[] result);
|
||||||
Assert.AreEqual(_expectedContents, result);
|
Assert.That(result, Is.EqualTo(_expectedContents));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
byte[] result = Md5Context.File(_location);
|
byte[] result = Md5Context.File(_location);
|
||||||
Assert.AreEqual(_expectedFile, result);
|
Assert.That(result, Is.EqualTo(_expectedFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new Aaru.Filters.BZip2();
|
IFilter filter = new Aaru.Filters.BZip2();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new Aaru.Filters.BZip2();
|
IFilter filter = new Aaru.Filters.BZip2();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(1048576, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(1048576));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(0, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(0));
|
||||||
Assert.AreEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.EqualTo(null));
|
||||||
Assert.AreEqual(false, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.EqualTo(false));
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// /***************************************************************************
|
// /***************************************************************************
|
||||||
// Aaru Data Preservation Suite
|
// Aaru Data Preservation Suite
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
@@ -62,33 +62,33 @@ public class GZip
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
Md5Context.Data(data, out byte[] result);
|
Md5Context.Data(data, out byte[] result);
|
||||||
Assert.AreEqual(_expectedContents, result);
|
Assert.That(result, Is.EqualTo(_expectedContents));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
byte[] result = Md5Context.File(_location);
|
byte[] result = Md5Context.File(_location);
|
||||||
Assert.AreEqual(_expectedFile, result);
|
Assert.That(result, Is.EqualTo(_expectedFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new Aaru.Filters.GZip();
|
IFilter filter = new Aaru.Filters.GZip();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new Aaru.Filters.GZip();
|
IFilter filter = new Aaru.Filters.GZip();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(1048576, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(1048576));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(0, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(0));
|
||||||
Assert.AreEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.EqualTo(null));
|
||||||
Assert.AreEqual(false, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.EqualTo(false));
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,33 +62,33 @@ public class LZip
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
Md5Context.Data(data, out byte[] result);
|
Md5Context.Data(data, out byte[] result);
|
||||||
Assert.AreEqual(_expectedContents, result);
|
Assert.That(result, Is.EqualTo(_expectedContents));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
byte[] result = Md5Context.File(_location);
|
byte[] result = Md5Context.File(_location);
|
||||||
Assert.AreEqual(_expectedFile, result);
|
Assert.That(result, Is.EqualTo(_expectedFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new Aaru.Filters.LZip();
|
IFilter filter = new Aaru.Filters.LZip();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new Aaru.Filters.LZip();
|
IFilter filter = new Aaru.Filters.LZip();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(1048576, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(1048576));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(0, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(0));
|
||||||
Assert.AreEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.EqualTo(null));
|
||||||
Assert.AreEqual(false, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.EqualTo(false));
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,21 +58,21 @@ public class MacBinary1
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_CONTENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
string result = Md5Context.File(_location, out _);
|
string result = Md5Context.File(_location, out _);
|
||||||
Assert.AreEqual(EXPECTED_FILE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_FILE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new MacBinary();
|
IFilter filter = new MacBinary();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -87,19 +87,19 @@ public class MacBinary1
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_RESOURCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new MacBinary();
|
IFilter filter = new MacBinary();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(737280, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(737280));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(286, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(286));
|
||||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(true, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.True);
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,21 +58,21 @@ public class MacBinary2
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_CONTENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
string result = Md5Context.File(_location, out _);
|
string result = Md5Context.File(_location, out _);
|
||||||
Assert.AreEqual(EXPECTED_FILE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_FILE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new MacBinary();
|
IFilter filter = new MacBinary();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -87,19 +87,19 @@ public class MacBinary2
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_RESOURCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new MacBinary();
|
IFilter filter = new MacBinary();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(737280, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(737280));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(286, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(286));
|
||||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(true, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.True);
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,21 +58,21 @@ public class MacBinary3
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_CONTENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
string result = Md5Context.File(_location, out _);
|
string result = Md5Context.File(_location, out _);
|
||||||
Assert.AreEqual(EXPECTED_FILE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_FILE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new MacBinary();
|
IFilter filter = new MacBinary();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -87,19 +87,19 @@ public class MacBinary3
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_RESOURCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new MacBinary();
|
IFilter filter = new MacBinary();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(737280, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(737280));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(286, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(286));
|
||||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(true, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.True);
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ public class PcExchange
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_CONTENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -67,14 +67,14 @@ public class PcExchange
|
|||||||
string result = Md5Context.File(Path.Combine(Consts.TestFilesRoot, "Filters", "PC Exchange", "FINDER.DAT"),
|
string result = Md5Context.File(Path.Combine(Consts.TestFilesRoot, "Filters", "PC Exchange", "FINDER.DAT"),
|
||||||
out _);
|
out _);
|
||||||
|
|
||||||
Assert.AreEqual(EXPECTED_FILE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_FILE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new Aaru.Filters.PcExchange();
|
IFilter filter = new Aaru.Filters.PcExchange();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -89,19 +89,19 @@ public class PcExchange
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
string result = Md5Context.Data(data, out _);
|
string result = Md5Context.Data(data, out _);
|
||||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
Assert.That(result, Is.EqualTo(EXPECTED_RESOURCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new Aaru.Filters.PcExchange();
|
IFilter filter = new Aaru.Filters.PcExchange();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(737280, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(737280));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(546, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(546));
|
||||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(true, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.True);
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,33 +63,33 @@ public class Xz
|
|||||||
str.Dispose();
|
str.Dispose();
|
||||||
filter.Close();
|
filter.Close();
|
||||||
Md5Context.Data(data, out byte[] result);
|
Md5Context.Data(data, out byte[] result);
|
||||||
Assert.AreEqual(_expectedContents, result);
|
Assert.That(result, Is.EqualTo(_expectedContents));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckCorrectFile()
|
public void CheckCorrectFile()
|
||||||
{
|
{
|
||||||
byte[] result = Md5Context.File(_location);
|
byte[] result = Md5Context.File(_location);
|
||||||
Assert.AreEqual(_expectedFile, result);
|
Assert.That(result, Is.EqualTo(_expectedFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CheckFilterId()
|
public void CheckFilterId()
|
||||||
{
|
{
|
||||||
IFilter filter = new XZ();
|
IFilter filter = new XZ();
|
||||||
Assert.AreEqual(true, filter.Identify(_location));
|
Assert.That(filter.Identify(_location), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test()
|
public void Test()
|
||||||
{
|
{
|
||||||
IFilter filter = new XZ();
|
IFilter filter = new XZ();
|
||||||
Assert.AreEqual(ErrorNumber.NoError, filter.Open(_location));
|
Assert.That(filter.Open(_location), Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.AreEqual(1048576, filter.DataForkLength);
|
Assert.That(filter.DataForkLength, Is.EqualTo(1048576));
|
||||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
Assert.That(filter.GetDataForkStream(), Is.Not.Null);
|
||||||
Assert.AreEqual(0, filter.ResourceForkLength);
|
Assert.That(filter.ResourceForkLength, Is.EqualTo(0));
|
||||||
Assert.AreEqual(null, filter.GetResourceForkStream());
|
Assert.That(filter.GetResourceForkStream(), Is.EqualTo(null));
|
||||||
Assert.AreEqual(false, filter.HasResourceFork);
|
Assert.That(filter.HasResourceFork, Is.EqualTo(false));
|
||||||
filter.Close();
|
filter.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,9 +23,9 @@ public class Marshal
|
|||||||
{
|
{
|
||||||
int count = Aaru.Helpers.Marshal.ConvertFromHexAscii(_testStrings[i], out byte[] buf);
|
int count = Aaru.Helpers.Marshal.ConvertFromHexAscii(_testStrings[i], out byte[] buf);
|
||||||
|
|
||||||
Assert.AreEqual(_resultBytes[i].Length, buf.Length);
|
Assert.That(buf, Has.Length.EqualTo(_resultBytes[i].Length));
|
||||||
Assert.AreEqual(_resultBytes[i].Length, count);
|
Assert.That(count, Is.EqualTo(_resultBytes[i].Length));
|
||||||
Assert.AreEqual(_resultBytes[i], buf);
|
Assert.That(buf, Is.EqualTo(_resultBytes[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
|||||||
string testFile = test.TestFile;
|
string testFile = test.TestFile;
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -45,10 +45,13 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
|||||||
filter.Open(testFile);
|
filter.Open(testFile);
|
||||||
|
|
||||||
var image = Activator.CreateInstance(Plugin.GetType()) as IMediaImage;
|
var image = Activator.CreateInstance(Plugin.GetType()) as IMediaImage;
|
||||||
Assert.NotNull(image, string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
|
||||||
|
Assert.That(image,
|
||||||
|
Is.Not.Null,
|
||||||
|
string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
||||||
|
|
||||||
ErrorNumber opened = image.Open(filter);
|
ErrorNumber opened = image.Open(filter);
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_0, testFile));
|
Assert.That(opened, Is.EqualTo(ErrorNumber.NoError), string.Format(Localization.Open_0, testFile));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) continue;
|
if(opened != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
@@ -56,17 +59,17 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
|||||||
{
|
{
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.AreEqual(test.Sectors,
|
Assert.That(image.Info.Sectors,
|
||||||
image.Info.Sectors,
|
Is.EqualTo(test.Sectors),
|
||||||
string.Format(Localization.Sectors_0, testFile));
|
string.Format(Localization.Sectors_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(test.SectorSize,
|
Assert.That(image.Info.SectorSize,
|
||||||
image.Info.SectorSize,
|
Is.EqualTo(test.SectorSize),
|
||||||
string.Format(Localization.Sector_size_0, testFile));
|
string.Format(Localization.Sector_size_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(test.MediaType,
|
Assert.That(image.Info.MediaType,
|
||||||
image.Info.MediaType,
|
Is.EqualTo(test.MediaType),
|
||||||
string.Format(Localization.Media_type_0, testFile));
|
string.Format(Localization.Media_type_0, testFile));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,7 +89,7 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
|||||||
string testFile = test.TestFile;
|
string testFile = test.TestFile;
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -96,10 +99,13 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
|||||||
filter.Open(testFile);
|
filter.Open(testFile);
|
||||||
|
|
||||||
var image = Activator.CreateInstance(Plugin.GetType()) as IMediaImage;
|
var image = Activator.CreateInstance(Plugin.GetType()) as IMediaImage;
|
||||||
Assert.NotNull(image, string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
|
||||||
|
Assert.That(image,
|
||||||
|
Is.Not.Null,
|
||||||
|
string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
||||||
|
|
||||||
ErrorNumber opened = image.Open(filter);
|
ErrorNumber opened = image.Open(filter);
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_0, testFile));
|
Assert.That(opened, Is.EqualTo(ErrorNumber.NoError), string.Format(Localization.Open_0, testFile));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) continue;
|
if(opened != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
@@ -122,11 +128,11 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
|||||||
doneSectors += image.Info.Sectors - doneSectors;
|
doneSectors += image.Info.Sectors - doneSectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, errno);
|
Assert.That(errno, Is.EqualTo(ErrorNumber.NoError));
|
||||||
ctx.Update(sector);
|
ctx.Update(sector);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(test.Md5, ctx.End(), string.Format(Localization.Hash_0, testFile));
|
Assert.That(ctx.End(), Is.EqualTo(test.Md5), string.Format(Localization.Hash_0, testFile));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -146,7 +152,7 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
|||||||
string testFile = test.TestFile;
|
string testFile = test.TestFile;
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -156,10 +162,13 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
|||||||
filter.Open(testFile);
|
filter.Open(testFile);
|
||||||
|
|
||||||
var image = Activator.CreateInstance(Plugin.GetType()) as IMediaImage;
|
var image = Activator.CreateInstance(Plugin.GetType()) as IMediaImage;
|
||||||
Assert.NotNull(image, string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
|
||||||
|
Assert.That(image,
|
||||||
|
Is.Not.Null,
|
||||||
|
string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
||||||
|
|
||||||
ErrorNumber opened = image.Open(filter);
|
ErrorNumber opened = image.Open(filter);
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_0, testFile));
|
Assert.That(opened, Is.EqualTo(ErrorNumber.NoError), string.Format(Localization.Open_0, testFile));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) continue;
|
if(opened != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
@@ -178,12 +187,12 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(test.Partitions.Length,
|
Assert.That(partitions,
|
||||||
partitions.Count,
|
Has.Count.EqualTo(test.Partitions.Length),
|
||||||
string.Format(Localization.Expected_0_partitions_in_1_but_found_2,
|
string.Format(Localization.Expected_0_partitions_in_1_but_found_2,
|
||||||
test.Partitions.Length,
|
test.Partitions.Length,
|
||||||
testFile,
|
testFile,
|
||||||
partitions.Count));
|
partitions.Count));
|
||||||
|
|
||||||
using(new AssertionScope())
|
using(new AssertionScope())
|
||||||
{
|
{
|
||||||
@@ -194,23 +203,23 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
|||||||
BlockPartitionVolumes expectedPartition = test.Partitions[i];
|
BlockPartitionVolumes expectedPartition = test.Partitions[i];
|
||||||
Partition foundPartition = partitions[i];
|
Partition foundPartition = partitions[i];
|
||||||
|
|
||||||
Assert.AreEqual(expectedPartition.Start,
|
Assert.That(foundPartition.Start,
|
||||||
foundPartition.Start,
|
Is.EqualTo(expectedPartition.Start),
|
||||||
string.Format(Localization
|
string.Format(Localization
|
||||||
.Expected_partition_0_to_start_at_sector_1_but_found_it_starts_at_2_in_3,
|
.Expected_partition_0_to_start_at_sector_1_but_found_it_starts_at_2_in_3,
|
||||||
i,
|
i,
|
||||||
expectedPartition.Start,
|
expectedPartition.Start,
|
||||||
foundPartition.Start,
|
foundPartition.Start,
|
||||||
testFile));
|
testFile));
|
||||||
|
|
||||||
Assert.AreEqual(expectedPartition.Length,
|
Assert.That(foundPartition.Length,
|
||||||
foundPartition.Length,
|
Is.EqualTo(expectedPartition.Length),
|
||||||
string.Format(Localization
|
string.Format(Localization
|
||||||
.Expected_partition_0_to_have_1_sectors_but_found_it_has_2_sectors_in_3,
|
.Expected_partition_0_to_have_1_sectors_but_found_it_has_2_sectors_in_3,
|
||||||
i,
|
i,
|
||||||
expectedPartition.Length,
|
expectedPartition.Length,
|
||||||
foundPartition.Length,
|
foundPartition.Length,
|
||||||
testFile));
|
testFile));
|
||||||
|
|
||||||
var expectedDataFilename = $"{testFile}.contents.partition{i}.json";
|
var expectedDataFilename = $"{testFile}.contents.partition{i}.json";
|
||||||
|
|
||||||
@@ -233,7 +242,7 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
|||||||
VolumeData[] expectedData = JsonSerializer.Deserialize<VolumeData[]>(sr, serializerOptions);
|
VolumeData[] expectedData = JsonSerializer.Deserialize<VolumeData[]>(sr, serializerOptions);
|
||||||
sr.Close();
|
sr.Close();
|
||||||
|
|
||||||
Assert.NotNull(expectedData);
|
Assert.That(expectedData, Is.Not.Null);
|
||||||
|
|
||||||
Core.Filesystems.Identify(image, out List<string> idPlugins, partitions[i]);
|
Core.Filesystems.Identify(image, out List<string> idPlugins, partitions[i]);
|
||||||
|
|
||||||
@@ -274,10 +283,10 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
|||||||
|
|
||||||
if(idPlugins.Count == 0) continue;
|
if(idPlugins.Count == 0) continue;
|
||||||
|
|
||||||
Assert.AreEqual(expectedData.Length,
|
Assert.That(idPlugins,
|
||||||
idPlugins.Count,
|
Has.Count.EqualTo(expectedData.Length),
|
||||||
$"Expected {expectedData.Length} filesystems identified in partition {i
|
$"Expected {expectedData.Length} filesystems identified in partition {i
|
||||||
} but found {idPlugins.Count} in {testFile}");
|
} but found {idPlugins.Count} in {testFile}");
|
||||||
|
|
||||||
for(var j = 0; j < idPlugins.Count; j++)
|
for(var j = 0; j < idPlugins.Count; j++)
|
||||||
{
|
{
|
||||||
@@ -286,13 +295,15 @@ public abstract class BlockMediaImageTest : BaseMediaImageTest
|
|||||||
if(!plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out IReadOnlyFilesystem fs))
|
if(!plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out IReadOnlyFilesystem fs))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Assert.IsNotNull(fs, $"Could not instantiate filesystem {pluginName} in {testFile}");
|
Assert.That(fs,
|
||||||
|
Is.Not.Null,
|
||||||
|
$"Could not instantiate filesystem {pluginName} in {testFile}");
|
||||||
|
|
||||||
ErrorNumber error = fs.Mount(image, partitions[i], null, null, null);
|
ErrorNumber error = fs.Mount(image, partitions[i], null, null, null);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(error,
|
||||||
error,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
$"Could not mount {pluginName} in partition {i} in {testFile}.");
|
$"Could not mount {pluginName} in partition {i} in {testFile}.");
|
||||||
|
|
||||||
if(error != ErrorNumber.NoError) continue;
|
if(error != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
string testFile = test.TestFile;
|
string testFile = test.TestFile;
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -53,10 +53,13 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
filter.Open(testFile);
|
filter.Open(testFile);
|
||||||
|
|
||||||
var image = Activator.CreateInstance(Plugin.GetType()) as IOpticalMediaImage;
|
var image = Activator.CreateInstance(Plugin.GetType()) as IOpticalMediaImage;
|
||||||
Assert.NotNull(image, string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
|
||||||
|
Assert.That(image,
|
||||||
|
Is.Not.Null,
|
||||||
|
string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
||||||
|
|
||||||
ErrorNumber opened = image.Open(filter);
|
ErrorNumber opened = image.Open(filter);
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_0, testFile));
|
Assert.That(opened, Is.EqualTo(ErrorNumber.NoError), string.Format(Localization.Open_0, testFile));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) continue;
|
if(opened != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
@@ -64,26 +67,26 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
{
|
{
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.AreEqual(test.Sectors,
|
Assert.That(image.Info.Sectors,
|
||||||
image.Info.Sectors,
|
Is.EqualTo(test.Sectors),
|
||||||
string.Format(Localization.Sectors_0, testFile));
|
string.Format(Localization.Sectors_0, testFile));
|
||||||
|
|
||||||
if(test.SectorSize > 0)
|
if(test.SectorSize > 0)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(test.SectorSize,
|
Assert.That(image.Info.SectorSize,
|
||||||
image.Info.SectorSize,
|
Is.EqualTo(test.SectorSize),
|
||||||
string.Format(Localization.Sector_size_0, testFile));
|
string.Format(Localization.Sector_size_0, testFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(test.MediaType,
|
Assert.That(image.Info.MediaType,
|
||||||
image.Info.MediaType,
|
Is.EqualTo(test.MediaType),
|
||||||
string.Format(Localization.Media_type_0, testFile));
|
string.Format(Localization.Media_type_0, testFile));
|
||||||
|
|
||||||
if(image.Info.MetadataMediaType != MetadataMediaType.OpticalDisc) return;
|
if(image.Info.MetadataMediaType != MetadataMediaType.OpticalDisc) return;
|
||||||
|
|
||||||
Assert.AreEqual(test.Tracks.Length,
|
Assert.That(image.Tracks,
|
||||||
image.Tracks.Count,
|
Has.Count.EqualTo(test.Tracks.Length),
|
||||||
string.Format(Localization.Tracks_0, testFile));
|
string.Format(Localization.Tracks_0, testFile));
|
||||||
|
|
||||||
image.Tracks.Select(t => t.Session)
|
image.Tracks.Select(t => t.Session)
|
||||||
.Should()
|
.Should()
|
||||||
@@ -133,11 +136,11 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
.BeEquivalentTo(test.Tracks.Select(s => s.Flags),
|
.BeEquivalentTo(test.Tracks.Select(s => s.Flags),
|
||||||
string.Format(Localization.Track_flags_0, testFile));
|
string.Format(Localization.Track_flags_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(latestEndSector,
|
Assert.That(image.Info.Sectors - 1,
|
||||||
image.Info.Sectors - 1,
|
Is.EqualTo(latestEndSector),
|
||||||
string.Format(Localization.Last_sector_for_tracks_is_0_but_it_is_1_for_image,
|
string.Format(Localization.Last_sector_for_tracks_is_0_but_it_is_1_for_image,
|
||||||
latestEndSector,
|
latestEndSector,
|
||||||
image.Info.Sectors));
|
image.Info.Sectors));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,7 +159,7 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
string testFile = test.TestFile;
|
string testFile = test.TestFile;
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -166,10 +169,13 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
filter.Open(testFile);
|
filter.Open(testFile);
|
||||||
|
|
||||||
var image = Activator.CreateInstance(Plugin.GetType()) as IOpticalMediaImage;
|
var image = Activator.CreateInstance(Plugin.GetType()) as IOpticalMediaImage;
|
||||||
Assert.NotNull(image, string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
|
||||||
|
Assert.That(image,
|
||||||
|
Is.Not.Null,
|
||||||
|
string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
||||||
|
|
||||||
ErrorNumber opened = image.Open(filter);
|
ErrorNumber opened = image.Open(filter);
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_0, testFile));
|
Assert.That(opened, Is.EqualTo(ErrorNumber.NoError), string.Format(Localization.Open_0, testFile));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) continue;
|
if(opened != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
@@ -193,12 +199,12 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
|
|
||||||
Core.Filesystems.Identify(image, out List<string> idPlugins, partition);
|
Core.Filesystems.Identify(image, out List<string> idPlugins, partition);
|
||||||
|
|
||||||
Assert.AreEqual(track.FileSystems.Length,
|
Assert.That(idPlugins,
|
||||||
idPlugins.Count,
|
Has.Count.EqualTo(track.FileSystems.Length),
|
||||||
string.Format(Localization.Expected_0_filesystems_in_1_but_found_2,
|
string.Format(Localization.Expected_0_filesystems_in_1_but_found_2,
|
||||||
track.FileSystems.Length,
|
track.FileSystems.Length,
|
||||||
testFile,
|
testFile,
|
||||||
idPlugins.Count));
|
idPlugins.Count));
|
||||||
|
|
||||||
for(var i = 0; i < track.FileSystems.Length; i++)
|
for(var i = 0; i < track.FileSystems.Length; i++)
|
||||||
{
|
{
|
||||||
@@ -209,49 +215,50 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
// It is not the case, it changes
|
// It is not the case, it changes
|
||||||
if(!found) continue;
|
if(!found) continue;
|
||||||
|
|
||||||
Assert.NotNull(fs,
|
Assert.That(fs,
|
||||||
string.Format(Localization.Could_not_instantiate_filesystem_for_0,
|
Is.Not.Null,
|
||||||
testFile));
|
string.Format(Localization.Could_not_instantiate_filesystem_for_0,
|
||||||
|
testFile));
|
||||||
|
|
||||||
fs.GetInformation(image, partition, null, out _, out FileSystem fsMetadata);
|
fs.GetInformation(image, partition, null, out _, out FileSystem fsMetadata);
|
||||||
|
|
||||||
if(track.FileSystems[i].ApplicationId != null)
|
if(track.FileSystems[i].ApplicationId != null)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(track.FileSystems[i].ApplicationId,
|
Assert.That(fsMetadata.ApplicationIdentifier,
|
||||||
fsMetadata.ApplicationIdentifier,
|
Is.EqualTo(track.FileSystems[i].ApplicationId),
|
||||||
string.Format(Localization.Application_ID_0, testFile));
|
string.Format(Localization.Application_ID_0, testFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(track.FileSystems[i].Bootable,
|
Assert.That(fsMetadata.Bootable,
|
||||||
fsMetadata.Bootable,
|
Is.EqualTo(track.FileSystems[i].Bootable),
|
||||||
string.Format(Localization.Bootable_0, testFile));
|
string.Format(Localization.Bootable_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(track.FileSystems[i].Clusters,
|
Assert.That(fsMetadata.Clusters,
|
||||||
fsMetadata.Clusters,
|
Is.EqualTo(track.FileSystems[i].Clusters),
|
||||||
string.Format(Localization.Clusters_0, testFile));
|
string.Format(Localization.Clusters_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(track.FileSystems[i].ClusterSize,
|
Assert.That(fsMetadata.ClusterSize,
|
||||||
fsMetadata.ClusterSize,
|
Is.EqualTo(track.FileSystems[i].ClusterSize),
|
||||||
string.Format(Localization.Cluster_size_0, testFile));
|
string.Format(Localization.Cluster_size_0, testFile));
|
||||||
|
|
||||||
if(track.FileSystems[i].SystemId != null)
|
if(track.FileSystems[i].SystemId != null)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(track.FileSystems[i].SystemId,
|
Assert.That(fsMetadata.SystemIdentifier,
|
||||||
fsMetadata.SystemIdentifier,
|
Is.EqualTo(track.FileSystems[i].SystemId),
|
||||||
string.Format(Localization.System_ID_0, testFile));
|
string.Format(Localization.System_ID_0, testFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(track.FileSystems[i].Type,
|
Assert.That(fsMetadata.Type,
|
||||||
fsMetadata.Type,
|
Is.EqualTo(track.FileSystems[i].Type),
|
||||||
string.Format(Localization.Filesystem_type_0, testFile));
|
string.Format(Localization.Filesystem_type_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(track.FileSystems[i].VolumeName,
|
Assert.That(fsMetadata.VolumeName,
|
||||||
fsMetadata.VolumeName,
|
Is.EqualTo(track.FileSystems[i].VolumeName),
|
||||||
string.Format(Localization.Volume_name_0, testFile));
|
string.Format(Localization.Volume_name_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(track.FileSystems[i].VolumeSerial,
|
Assert.That(fsMetadata.VolumeSerial,
|
||||||
fsMetadata.VolumeSerial,
|
Is.EqualTo(track.FileSystems[i].VolumeSerial),
|
||||||
string.Format(Localization.Volume_serial_0, testFile));
|
string.Format(Localization.Volume_serial_0, testFile));
|
||||||
|
|
||||||
if(fs is not IReadOnlyFilesystem rofs)
|
if(fs is not IReadOnlyFilesystem rofs)
|
||||||
{
|
{
|
||||||
@@ -259,12 +266,11 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
track.FileSystems[i].ContentsJson != null ||
|
track.FileSystems[i].ContentsJson != null ||
|
||||||
File.Exists($"{testFile}.track{track.Number}.filesystem{i}.contents.json"))
|
File.Exists($"{testFile}.track{track.Number}.filesystem{i}.contents.json"))
|
||||||
{
|
{
|
||||||
Assert.NotNull(null,
|
Assert.Fail(string.Format(Localization
|
||||||
string.Format(Localization
|
.Could_not_instantiate_filesystem_for_0_track_1_filesystem_2,
|
||||||
.Could_not_instantiate_filesystem_for_0_track_1_filesystem_2,
|
testFile,
|
||||||
testFile,
|
track.Number,
|
||||||
track.Number,
|
i));
|
||||||
i));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -278,9 +284,9 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
null,
|
null,
|
||||||
track.FileSystems[i].Namespace);
|
track.FileSystems[i].Namespace);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(ret,
|
||||||
ret,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Unmountable_0, testFile));
|
string.Format(Localization.Unmountable_0, testFile));
|
||||||
|
|
||||||
var serializerOptions = new JsonSerializerOptions
|
var serializerOptions = new JsonSerializerOptions
|
||||||
{
|
{
|
||||||
@@ -375,7 +381,7 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
string testFile = Tests[i].TestFile;
|
string testFile = Tests[i].TestFile;
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -386,12 +392,15 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
|
|
||||||
var image = Activator.CreateInstance(Plugin.GetType()) as IOpticalMediaImage;
|
var image = Activator.CreateInstance(Plugin.GetType()) as IOpticalMediaImage;
|
||||||
|
|
||||||
Assert.NotNull(image,
|
Assert.That(image,
|
||||||
string.Format(Localization.Could_not_instantiate_filesystem_for_0,
|
Is.Not.Null,
|
||||||
testFile));
|
string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
||||||
|
|
||||||
ErrorNumber opened = image.Open(filter);
|
ErrorNumber opened = image.Open(filter);
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_0, testFile));
|
|
||||||
|
Assert.That(opened,
|
||||||
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
|
string.Format(Localization.Open_0, testFile));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) return;
|
if(opened != ErrorNumber.NoError) return;
|
||||||
|
|
||||||
@@ -444,15 +453,15 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
doneSectors += sectors - doneSectors;
|
doneSectors += sectors - doneSectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, errno);
|
Assert.That(errno, Is.EqualTo(ErrorNumber.NoError));
|
||||||
|
|
||||||
ctx.Update(sector);
|
ctx.Update(sector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(@long ? Tests[i].LongMd5 : Tests[i].Md5,
|
Assert.That(ctx.End(),
|
||||||
ctx.End(),
|
Is.EqualTo(@long ? Tests[i].LongMd5 : Tests[i].Md5),
|
||||||
$"{(@long ? "Long hash" : "Hash")}: {testFile}");
|
$"{(@long ? "Long hash" : "Hash")}: {testFile}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel)) return;
|
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel)) return;
|
||||||
@@ -489,14 +498,14 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
doneSectors += sectors - doneSectors;
|
doneSectors += sectors - doneSectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, errno);
|
Assert.That(errno, Is.EqualTo(ErrorNumber.NoError));
|
||||||
ctx.Update(sector);
|
ctx.Update(sector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(Tests[i].SubchannelMd5,
|
Assert.That(ctx.End(),
|
||||||
ctx.End(),
|
Is.EqualTo(Tests[i].SubchannelMd5),
|
||||||
string.Format(Localization.Subchannel_hash_0, testFile));
|
string.Format(Localization.Subchannel_hash_0, testFile));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -521,11 +530,13 @@ public abstract class OpticalMediaImageTest : BaseMediaImageTest
|
|||||||
doneSectors += image.Info.Sectors - doneSectors;
|
doneSectors += image.Info.Sectors - doneSectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, errno);
|
Assert.That(errno, Is.EqualTo(ErrorNumber.NoError));
|
||||||
ctx.Update(sector);
|
ctx.Update(sector);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(Tests[i].Md5, ctx.End(), string.Format(Localization.Hash_0, testFile));
|
Assert.That(ctx.End(),
|
||||||
|
Is.EqualTo(Tests[i].Md5),
|
||||||
|
string.Format(Localization.Hash_0, testFile));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public abstract class TapeMediaImageTest : BaseMediaImageTest
|
|||||||
string testFile = test.TestFile;
|
string testFile = test.TestFile;
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -44,14 +44,17 @@ public abstract class TapeMediaImageTest : BaseMediaImageTest
|
|||||||
filter.Open(testFile);
|
filter.Open(testFile);
|
||||||
|
|
||||||
var image = Activator.CreateInstance(Plugin.GetType()) as ITapeImage;
|
var image = Activator.CreateInstance(Plugin.GetType()) as ITapeImage;
|
||||||
Assert.NotNull(image, string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
|
||||||
|
Assert.That(image,
|
||||||
|
Is.Not.Null,
|
||||||
|
string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
||||||
|
|
||||||
ErrorNumber opened = image.Open(filter);
|
ErrorNumber opened = image.Open(filter);
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_0, testFile));
|
Assert.That(opened, Is.EqualTo(ErrorNumber.NoError), string.Format(Localization.Open_0, testFile));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) continue;
|
if(opened != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
Assert.AreEqual(true, image.IsTape, string.Format(Localization.Is_tape_0, testFile));
|
Assert.That(image.IsTape, Is.True, string.Format(Localization.Is_tape_0, testFile));
|
||||||
|
|
||||||
using(new AssertionScope())
|
using(new AssertionScope())
|
||||||
{
|
{
|
||||||
@@ -80,7 +83,7 @@ public abstract class TapeMediaImageTest : BaseMediaImageTest
|
|||||||
string testFile = test.TestFile;
|
string testFile = test.TestFile;
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -90,10 +93,13 @@ public abstract class TapeMediaImageTest : BaseMediaImageTest
|
|||||||
filter.Open(testFile);
|
filter.Open(testFile);
|
||||||
|
|
||||||
var image = Activator.CreateInstance(Plugin.GetType()) as IMediaImage;
|
var image = Activator.CreateInstance(Plugin.GetType()) as IMediaImage;
|
||||||
Assert.NotNull(image, string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
|
||||||
|
Assert.That(image,
|
||||||
|
Is.Not.Null,
|
||||||
|
string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
||||||
|
|
||||||
ErrorNumber opened = image.Open(filter);
|
ErrorNumber opened = image.Open(filter);
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_0, testFile));
|
Assert.That(opened, Is.EqualTo(ErrorNumber.NoError), string.Format(Localization.Open_0, testFile));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) continue;
|
if(opened != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
@@ -101,17 +107,17 @@ public abstract class TapeMediaImageTest : BaseMediaImageTest
|
|||||||
{
|
{
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.AreEqual(test.Sectors,
|
Assert.That(image.Info.Sectors,
|
||||||
image.Info.Sectors,
|
Is.EqualTo(test.Sectors),
|
||||||
string.Format(Localization.Sectors_0, testFile));
|
string.Format(Localization.Sectors_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(test.SectorSize,
|
Assert.That(image.Info.SectorSize,
|
||||||
image.Info.SectorSize,
|
Is.EqualTo(test.SectorSize),
|
||||||
string.Format(Localization.Sector_size_0, testFile));
|
string.Format(Localization.Sector_size_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(test.MediaType,
|
Assert.That(image.Info.MediaType,
|
||||||
image.Info.MediaType,
|
Is.EqualTo(test.MediaType),
|
||||||
string.Format(Localization.Media_type_0, testFile));
|
string.Format(Localization.Media_type_0, testFile));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,7 +137,7 @@ public abstract class TapeMediaImageTest : BaseMediaImageTest
|
|||||||
string testFile = test.TestFile;
|
string testFile = test.TestFile;
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -141,10 +147,13 @@ public abstract class TapeMediaImageTest : BaseMediaImageTest
|
|||||||
filter.Open(testFile);
|
filter.Open(testFile);
|
||||||
|
|
||||||
var image = Activator.CreateInstance(Plugin.GetType()) as IMediaImage;
|
var image = Activator.CreateInstance(Plugin.GetType()) as IMediaImage;
|
||||||
Assert.NotNull(image, string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
|
||||||
|
Assert.That(image,
|
||||||
|
Is.Not.Null,
|
||||||
|
string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
||||||
|
|
||||||
ErrorNumber opened = image.Open(filter);
|
ErrorNumber opened = image.Open(filter);
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_0, testFile));
|
Assert.That(opened, Is.EqualTo(ErrorNumber.NoError), string.Format(Localization.Open_0, testFile));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) continue;
|
if(opened != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
@@ -167,11 +176,11 @@ public abstract class TapeMediaImageTest : BaseMediaImageTest
|
|||||||
doneSectors += image.Info.Sectors - doneSectors;
|
doneSectors += image.Info.Sectors - doneSectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, errno);
|
Assert.That(errno, Is.EqualTo(ErrorNumber.NoError));
|
||||||
ctx.Update(sector);
|
ctx.Update(sector);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(test.Md5, ctx.End(), string.Format(Localization.Hash_0, testFile));
|
Assert.That(ctx.End(), Is.EqualTo(test.Md5), string.Format(Localization.Hash_0, testFile));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public abstract class FsExtractHashIssueTest
|
|||||||
Dictionary<string, string> options = ParsedOptions;
|
Dictionary<string, string> options = ParsedOptions;
|
||||||
options["debug"] = Debug.ToString();
|
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;
|
Encoding encodingClass = null;
|
||||||
|
|
||||||
@@ -52,15 +52,17 @@ public abstract class FsExtractHashIssueTest
|
|||||||
|
|
||||||
var imageFormat = ImageFormat.Detect(inputFilter) as IMediaImage;
|
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);
|
List<Partition> partitions = Core.Partitions.GetAll(imageFormat);
|
||||||
|
|
||||||
if(partitions.Count == 0)
|
if(partitions.Count == 0)
|
||||||
{
|
{
|
||||||
Assert.IsFalse(ExpectPartitions, Localization.No_partitions_found);
|
Assert.That(ExpectPartitions, Is.False, Localization.No_partitions_found);
|
||||||
|
|
||||||
partitions.Add(new Partition
|
partitions.Add(new Partition
|
||||||
{
|
{
|
||||||
@@ -75,7 +77,7 @@ public abstract class FsExtractHashIssueTest
|
|||||||
|
|
||||||
var filesystemFound = false;
|
var filesystemFound = false;
|
||||||
|
|
||||||
Assert.True(File.Exists($"{TestFile}.unittest.json"));
|
Assert.That(File.Exists($"{TestFile}.unittest.json"));
|
||||||
|
|
||||||
var serializerOptions = new JsonSerializerOptions
|
var serializerOptions = new JsonSerializerOptions
|
||||||
{
|
{
|
||||||
@@ -93,13 +95,13 @@ public abstract class FsExtractHashIssueTest
|
|||||||
var sr = new FileStream($"{TestFile}.unittest.json", FileMode.Open);
|
var sr = new FileStream($"{TestFile}.unittest.json", FileMode.Open);
|
||||||
FsExtractHashData expectedData = JsonSerializer.Deserialize<FsExtractHashData>(sr, serializerOptions);
|
FsExtractHashData expectedData = JsonSerializer.Deserialize<FsExtractHashData>(sr, serializerOptions);
|
||||||
|
|
||||||
Assert.NotNull(expectedData);
|
Assert.That(expectedData, Is.Not.Null);
|
||||||
|
|
||||||
Assert.AreEqual(expectedData.Partitions.Length,
|
Assert.That(partitions,
|
||||||
partitions.Count,
|
Has.Count.EqualTo(expectedData.Partitions.Length),
|
||||||
string.Format(Localization.Excepted_0_partitions_but_found_1,
|
string.Format(Localization.Excepted_0_partitions_but_found_1,
|
||||||
expectedData.Partitions.Length,
|
expectedData.Partitions.Length,
|
||||||
partitions.Count));
|
partitions.Count));
|
||||||
|
|
||||||
for(var i = 0; i < partitions.Count; i++)
|
for(var i = 0; i < partitions.Count; i++)
|
||||||
{
|
{
|
||||||
@@ -107,22 +109,23 @@ public abstract class FsExtractHashIssueTest
|
|||||||
|
|
||||||
if(idPlugins.Count == 0)
|
if(idPlugins.Count == 0)
|
||||||
{
|
{
|
||||||
Assert.IsNull(expectedData.Partitions[i],
|
Assert.That(expectedData.Partitions[i],
|
||||||
string.Format(Localization.Expected_no_filesystems_identified_in_partition_0_but_found_1,
|
Is.Null,
|
||||||
i,
|
string.Format(Localization.Expected_no_filesystems_identified_in_partition_0_but_found_1,
|
||||||
idPlugins.Count));
|
i,
|
||||||
|
idPlugins.Count));
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(expectedData.Partitions[i].Volumes is null) continue;
|
if(expectedData.Partitions[i].Volumes is null) continue;
|
||||||
|
|
||||||
Assert.AreEqual(expectedData.Partitions[i].Volumes.Length,
|
Assert.That(idPlugins,
|
||||||
idPlugins.Count,
|
Has.Count.EqualTo(expectedData.Partitions[i].Volumes.Length),
|
||||||
string.Format(Localization.Expected_0_filesystems_identified_in_partition_1_but_found_2,
|
string.Format(Localization.Expected_0_filesystems_identified_in_partition_1_but_found_2,
|
||||||
expectedData.Partitions[i].Volumes.Length,
|
expectedData.Partitions[i].Volumes.Length,
|
||||||
i,
|
i,
|
||||||
idPlugins.Count));
|
idPlugins.Count));
|
||||||
|
|
||||||
for(var j = 0; j < idPlugins.Count; j++)
|
for(var j = 0; j < idPlugins.Count; j++)
|
||||||
{
|
{
|
||||||
@@ -130,24 +133,26 @@ public abstract class FsExtractHashIssueTest
|
|||||||
|
|
||||||
if(!plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out IReadOnlyFilesystem fs)) continue;
|
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;
|
filesystemFound = true;
|
||||||
|
|
||||||
ErrorNumber error = fs.Mount(imageFormat, partitions[i], encodingClass, options, Namespace);
|
ErrorNumber error = fs.Mount(imageFormat, partitions[i], encodingClass, options, Namespace);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(error,
|
||||||
error,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Could_not_mount_0_in_partition_1, pluginName, i));
|
string.Format(Localization.Could_not_mount_0_in_partition_1, pluginName, i));
|
||||||
|
|
||||||
Assert.AreEqual(expectedData.Partitions[i].Volumes[j].VolumeName,
|
Assert.That(fs.Metadata.VolumeName,
|
||||||
fs.Metadata.VolumeName,
|
Is.EqualTo(expectedData.Partitions[i].Volumes[j].VolumeName),
|
||||||
string.Format(Localization
|
string.Format(Localization
|
||||||
.Excepted_volume_name_0_for_filesystem_1_in_partition_2_but_found_3,
|
.Excepted_volume_name_0_for_filesystem_1_in_partition_2_but_found_3,
|
||||||
expectedData.Partitions[i].Volumes[j].VolumeName,
|
expectedData.Partitions[i].Volumes[j].VolumeName,
|
||||||
j,
|
j,
|
||||||
i,
|
i,
|
||||||
fs.Metadata.VolumeName));
|
fs.Metadata.VolumeName));
|
||||||
|
|
||||||
VolumeData volumeData = expectedData.Partitions[i].Volumes[j];
|
VolumeData volumeData = expectedData.Partitions[i].Volumes[j];
|
||||||
|
|
||||||
@@ -160,7 +165,7 @@ public abstract class FsExtractHashIssueTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsTrue(filesystemFound, Localization.No_filesystems_found);
|
Assert.That(filesystemFound, Localization.No_filesystems_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ExtractFilesInDir(string path, IReadOnlyFilesystem fs, bool doXattrs, VolumeData volumeData)
|
static void ExtractFilesInDir(string path, IReadOnlyFilesystem fs, bool doXattrs, VolumeData volumeData)
|
||||||
@@ -169,30 +174,32 @@ public abstract class FsExtractHashIssueTest
|
|||||||
|
|
||||||
ErrorNumber error = fs.OpenDir(path, out IDirNode node);
|
ErrorNumber error = fs.OpenDir(path, out IDirNode node);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(error,
|
||||||
error,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_reading_root_directory, error.ToString()));
|
string.Format(Localization.Error_0_reading_root_directory, error.ToString()));
|
||||||
|
|
||||||
while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError && entry is not null)
|
while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError && entry is not null)
|
||||||
{
|
{
|
||||||
error = fs.Stat(path + "/" + entry, out FileEntryInfo stat);
|
error = fs.Stat(path + "/" + entry, out FileEntryInfo stat);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(error,
|
||||||
error,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_getting_stat_for_entry_0, entry));
|
string.Format(Localization.Error_getting_stat_for_entry_0, entry));
|
||||||
|
|
||||||
if(stat.Attributes.HasFlag(FileAttributes.Directory))
|
if(stat.Attributes.HasFlag(FileAttributes.Directory))
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(path))
|
if(string.IsNullOrWhiteSpace(path))
|
||||||
{
|
{
|
||||||
Assert.True(volumeData.Directories.Contains(entry),
|
Assert.That(volumeData.Directories,
|
||||||
|
Does.Contain(entry),
|
||||||
string.Format(Localization.Found_unexpected_directory_0, entry));
|
string.Format(Localization.Found_unexpected_directory_0, entry));
|
||||||
|
|
||||||
volumeData.Directories.Remove(entry);
|
volumeData.Directories.Remove(entry);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Assert.True(volumeData.Directories.Contains(path + "/" + entry),
|
Assert.That(volumeData.Directories,
|
||||||
|
Does.Contain(path + "/" + entry),
|
||||||
string.Format(Localization.Found_unexpected_directory_0, path + "/" + entry));
|
string.Format(Localization.Found_unexpected_directory_0, path + "/" + entry));
|
||||||
|
|
||||||
volumeData.Directories.Remove(path + "/" + entry);
|
volumeData.Directories.Remove(path + "/" + entry);
|
||||||
@@ -207,15 +214,15 @@ public abstract class FsExtractHashIssueTest
|
|||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(path))
|
if(string.IsNullOrWhiteSpace(path))
|
||||||
{
|
{
|
||||||
Assert.IsTrue(volumeData.Files.TryGetValue(entry, out fileData),
|
Assert.That(volumeData.Files.TryGetValue(entry, out fileData),
|
||||||
string.Format(Localization.Found_unexpected_file_0, entry));
|
string.Format(Localization.Found_unexpected_file_0, entry));
|
||||||
|
|
||||||
volumeData.Files.Remove(entry);
|
volumeData.Files.Remove(entry);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Assert.IsTrue(volumeData.Files.TryGetValue(path + "/" + entry, out fileData),
|
Assert.That(volumeData.Files.TryGetValue(path + "/" + entry, out fileData),
|
||||||
string.Format(Localization.Found_unexpected_file_0, path + "/" + entry));
|
string.Format(Localization.Found_unexpected_file_0, path + "/" + entry));
|
||||||
|
|
||||||
volumeData.Files.Remove(path + "/" + entry);
|
volumeData.Files.Remove(path + "/" + entry);
|
||||||
}
|
}
|
||||||
@@ -224,11 +231,11 @@ public abstract class FsExtractHashIssueTest
|
|||||||
{
|
{
|
||||||
error = fs.ListXAttr(path + "/" + entry, out List<string> xattrs);
|
error = fs.ListXAttr(path + "/" + entry, out List<string> xattrs);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(error,
|
||||||
error,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_getting_extended_attributes_for_entry_1,
|
string.Format(Localization.Error_0_getting_extended_attributes_for_entry_1,
|
||||||
error,
|
error,
|
||||||
path + "/" + entry));
|
path + "/" + entry));
|
||||||
|
|
||||||
Dictionary<string, string> expectedXattrs = fileData.XattrsWithMd5;
|
Dictionary<string, string> expectedXattrs = fileData.XattrsWithMd5;
|
||||||
|
|
||||||
@@ -236,29 +243,29 @@ public abstract class FsExtractHashIssueTest
|
|||||||
{
|
{
|
||||||
foreach(string xattr in xattrs)
|
foreach(string xattr in xattrs)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(expectedXattrs.TryGetValue(xattr, out string expectedXattrMd5),
|
Assert.That(expectedXattrs.TryGetValue(xattr, out string expectedXattrMd5),
|
||||||
string.Format(Localization.Found_unexpected_extended_attribute_0_in_file_1,
|
string.Format(Localization.Found_unexpected_extended_attribute_0_in_file_1,
|
||||||
xattr,
|
xattr,
|
||||||
entry));
|
entry));
|
||||||
|
|
||||||
expectedXattrs.Remove(xattr);
|
expectedXattrs.Remove(xattr);
|
||||||
|
|
||||||
byte[] xattrBuf = [];
|
byte[] xattrBuf = [];
|
||||||
error = fs.GetXattr(path + "/" + entry, xattr, ref xattrBuf);
|
error = fs.GetXattr(path + "/" + entry, xattr, ref xattrBuf);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(error,
|
||||||
error,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_reading_extended_attributes_for_entry_1,
|
string.Format(Localization.Error_0_reading_extended_attributes_for_entry_1,
|
||||||
error,
|
error,
|
||||||
path + "/" + entry));
|
path + "/" + entry));
|
||||||
|
|
||||||
string xattrMd5 = Md5Context.Data(xattrBuf, out _);
|
string xattrMd5 = Md5Context.Data(xattrBuf, out _);
|
||||||
|
|
||||||
Assert.AreEqual(expectedXattrMd5,
|
Assert.That(xattrMd5,
|
||||||
xattrMd5,
|
Is.EqualTo(expectedXattrMd5),
|
||||||
string.Format(Localization.Invalid_checksum_for_xattr_0_for_file_1,
|
string.Format(Localization.Invalid_checksum_for_xattr_0_for_file_1,
|
||||||
xattr,
|
xattr,
|
||||||
path + "/" + entry));
|
path + "/" + entry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,30 +278,27 @@ public abstract class FsExtractHashIssueTest
|
|||||||
var buffer = new byte[stat.Length];
|
var buffer = new byte[stat.Length];
|
||||||
ErrorNumber ret = fs.OpenFile(path + "/" + entry, out IFileNode fileNode);
|
ErrorNumber ret = fs.OpenFile(path + "/" + entry, out IFileNode fileNode);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(ret,
|
||||||
ret,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_reading_file_1, ret, path + "/" + entry));
|
string.Format(Localization.Error_0_reading_file_1, ret, path + "/" + entry));
|
||||||
|
|
||||||
ret = fs.ReadFile(fileNode, stat.Length, buffer, out long readBytes);
|
ret = fs.ReadFile(fileNode, stat.Length, buffer, out long readBytes);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(ret,
|
||||||
ret,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_reading_file_1, ret, path + "/" + entry));
|
string.Format(Localization.Error_0_reading_file_1, ret, path + "/" + entry));
|
||||||
|
|
||||||
Assert.AreEqual(stat.Length,
|
Assert.That(readBytes,
|
||||||
readBytes,
|
Is.EqualTo(stat.Length),
|
||||||
string.Format(Localization.Error_0_reading_file_1,
|
string.Format(Localization.Error_0_reading_file_1, readBytes, stat.Length, path + "/" + entry));
|
||||||
readBytes,
|
|
||||||
stat.Length,
|
|
||||||
path + "/" + entry));
|
|
||||||
|
|
||||||
fs.CloseFile(fileNode);
|
fs.CloseFile(fileNode);
|
||||||
|
|
||||||
string calculatedMd5 = Md5Context.Data(buffer, out _);
|
string calculatedMd5 = Md5Context.Data(buffer, out _);
|
||||||
|
|
||||||
Assert.AreEqual(fileData.Md5,
|
Assert.That(calculatedMd5,
|
||||||
calculatedMd5,
|
Is.EqualTo(fileData.Md5),
|
||||||
string.Format(Localization.Invalid_checksum_for_file_0, path + "/" + entry));
|
string.Format(Localization.Invalid_checksum_for_file_0, path + "/" + entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.CloseDir(node);
|
fs.CloseDir(node);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public abstract class FsExtractIssueTest
|
|||||||
Dictionary<string, string> options = ParsedOptions;
|
Dictionary<string, string> options = ParsedOptions;
|
||||||
options["debug"] = Debug.ToString();
|
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;
|
Encoding encodingClass = null;
|
||||||
|
|
||||||
@@ -45,15 +45,17 @@ public abstract class FsExtractIssueTest
|
|||||||
|
|
||||||
var imageFormat = ImageFormat.Detect(inputFilter) as IMediaImage;
|
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);
|
List<Partition> partitions = Core.Partitions.GetAll(imageFormat);
|
||||||
|
|
||||||
if(partitions.Count == 0)
|
if(partitions.Count == 0)
|
||||||
{
|
{
|
||||||
Assert.IsFalse(ExpectPartitions, Localization.No_partitions_found);
|
Assert.That(ExpectPartitions, Is.False, Localization.No_partitions_found);
|
||||||
|
|
||||||
partitions.Add(new Partition
|
partitions.Add(new Partition
|
||||||
{
|
{
|
||||||
@@ -82,15 +84,17 @@ public abstract class FsExtractIssueTest
|
|||||||
{
|
{
|
||||||
if(!plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out IReadOnlyFilesystem fs)) continue;
|
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;
|
filesystemFound = true;
|
||||||
|
|
||||||
error = fs.Mount(imageFormat, partitions[i], encodingClass, options, Namespace);
|
error = fs.Mount(imageFormat, partitions[i], encodingClass, options, Namespace);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(error,
|
||||||
error,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Could_not_mount_0_in_partition_1, pluginName, i));
|
string.Format(Localization.Could_not_mount_0_in_partition_1, pluginName, i));
|
||||||
|
|
||||||
ExtractFilesInDir("/", fs, Xattrs);
|
ExtractFilesInDir("/", fs, Xattrs);
|
||||||
}
|
}
|
||||||
@@ -99,21 +103,21 @@ public abstract class FsExtractIssueTest
|
|||||||
{
|
{
|
||||||
plugins.ReadOnlyFilesystems.TryGetValue(idPlugins[0], out IReadOnlyFilesystem fs);
|
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;
|
filesystemFound = true;
|
||||||
|
|
||||||
error = fs.Mount(imageFormat, partitions[i], encodingClass, options, Namespace);
|
error = fs.Mount(imageFormat, partitions[i], encodingClass, options, Namespace);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(error,
|
||||||
error,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Could_not_mount_0_in_partition_1, fs.Name, i));
|
string.Format(Localization.Could_not_mount_0_in_partition_1, fs.Name, i));
|
||||||
|
|
||||||
ExtractFilesInDir("/", fs, Xattrs);
|
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)
|
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);
|
ErrorNumber error = fs.OpenDir(path, out IDirNode node);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(error,
|
||||||
error,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_reading_root_directory, error.ToString()));
|
string.Format(Localization.Error_0_reading_root_directory, error.ToString()));
|
||||||
|
|
||||||
while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError && entry is not null)
|
while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError && entry is not null)
|
||||||
{
|
{
|
||||||
error = fs.Stat(path + "/" + entry, out FileEntryInfo stat);
|
error = fs.Stat(path + "/" + entry, out FileEntryInfo stat);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(error,
|
||||||
error,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_getting_stat_for_entry_0, entry));
|
string.Format(Localization.Error_getting_stat_for_entry_0, entry));
|
||||||
|
|
||||||
if(stat.Attributes.HasFlag(FileAttributes.Directory))
|
if(stat.Attributes.HasFlag(FileAttributes.Directory))
|
||||||
{
|
{
|
||||||
@@ -145,11 +149,11 @@ public abstract class FsExtractIssueTest
|
|||||||
{
|
{
|
||||||
error = fs.ListXAttr(path + "/" + entry, out List<string> xattrs);
|
error = fs.ListXAttr(path + "/" + entry, out List<string> xattrs);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(error,
|
||||||
error,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_getting_extended_attributes_for_entry_1,
|
string.Format(Localization.Error_0_getting_extended_attributes_for_entry_1,
|
||||||
error,
|
error,
|
||||||
path + "/" + entry));
|
path + "/" + entry));
|
||||||
|
|
||||||
if(error == ErrorNumber.NoError)
|
if(error == ErrorNumber.NoError)
|
||||||
{
|
{
|
||||||
@@ -158,11 +162,11 @@ public abstract class FsExtractIssueTest
|
|||||||
byte[] xattrBuf = [];
|
byte[] xattrBuf = [];
|
||||||
error = fs.GetXattr(path + "/" + entry, xattr, ref xattrBuf);
|
error = fs.GetXattr(path + "/" + entry, xattr, ref xattrBuf);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(error,
|
||||||
error,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_reading_extended_attributes_for_entry_1,
|
string.Format(Localization.Error_0_reading_extended_attributes_for_entry_1,
|
||||||
error,
|
error,
|
||||||
path + "/" + entry));
|
path + "/" + entry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,22 +174,19 @@ public abstract class FsExtractIssueTest
|
|||||||
var buffer = new byte[stat.Length];
|
var buffer = new byte[stat.Length];
|
||||||
ErrorNumber ret = fs.OpenFile(path + "/" + entry, out IFileNode fileNode);
|
ErrorNumber ret = fs.OpenFile(path + "/" + entry, out IFileNode fileNode);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(ret,
|
||||||
ret,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_reading_file_1, ret, path + "/" + entry));
|
string.Format(Localization.Error_0_reading_file_1, ret, path + "/" + entry));
|
||||||
|
|
||||||
ret = fs.ReadFile(fileNode, stat.Length, buffer, out long readBytes);
|
ret = fs.ReadFile(fileNode, stat.Length, buffer, out long readBytes);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(ret,
|
||||||
ret,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_reading_file_1, ret, path + "/" + entry));
|
string.Format(Localization.Error_0_reading_file_1, ret, path + "/" + entry));
|
||||||
|
|
||||||
Assert.AreEqual(stat.Length,
|
Assert.That(readBytes,
|
||||||
readBytes,
|
Is.EqualTo(stat.Length),
|
||||||
string.Format(Localization.Error_0_reading_file_1,
|
string.Format(Localization.Error_0_reading_file_1, readBytes, stat.Length, path + "/" + entry));
|
||||||
readBytes,
|
|
||||||
stat.Length,
|
|
||||||
path + "/" + entry));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.CloseDir(node);
|
fs.CloseDir(node);
|
||||||
|
|||||||
@@ -25,17 +25,19 @@ public abstract class ImageReadIssueTest
|
|||||||
Environment.CurrentDirectory = DataFolder;
|
Environment.CurrentDirectory = DataFolder;
|
||||||
|
|
||||||
bool exists = File.Exists(TestFile);
|
bool exists = File.Exists(TestFile);
|
||||||
Assert.True(exists, Localization.Test_file_not_found);
|
Assert.That(exists, Localization.Test_file_not_found);
|
||||||
|
|
||||||
IFilter inputFilter = PluginRegister.Singleton.GetFilter(TestFile);
|
IFilter inputFilter = PluginRegister.Singleton.GetFilter(TestFile);
|
||||||
|
|
||||||
Assert.IsNotNull(inputFilter, Localization.Filter_for_test_file_is_not_detected);
|
Assert.That(inputFilter, Is.Not.Null, Localization.Filter_for_test_file_is_not_detected);
|
||||||
|
|
||||||
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
|
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
|
||||||
|
|
||||||
Assert.IsNotNull(image, Localization.Image_format_for_test_file_is_not_detected);
|
Assert.That(image, Is.Not.Null, Localization.Image_format_for_test_file_is_not_detected);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, image.Open(inputFilter), Localization.Cannot_open_image_for_test_file);
|
Assert.That(image.Open(inputFilter),
|
||||||
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
|
Localization.Cannot_open_image_for_test_file);
|
||||||
|
|
||||||
ulong doneSectors = 0;
|
ulong doneSectors = 0;
|
||||||
var ctx = new Crc32Context();
|
var ctx = new Crc32Context();
|
||||||
@@ -57,7 +59,7 @@ public abstract class ImageReadIssueTest
|
|||||||
doneSectors += image.Info.Sectors - doneSectors;
|
doneSectors += image.Info.Sectors - doneSectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, errno);
|
Assert.That(errno, Is.EqualTo(ErrorNumber.NoError));
|
||||||
|
|
||||||
ctx.Update(sector);
|
ctx.Update(sector);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,37 +52,42 @@ public abstract class OpticalImageConvertIssueTest
|
|||||||
|
|
||||||
IFilter inputFilter = PluginRegister.Singleton.GetFilter(InputPath);
|
IFilter inputFilter = PluginRegister.Singleton.GetFilter(InputPath);
|
||||||
|
|
||||||
Assert.IsNotNull(inputFilter, Localization.Cannot_open_specified_file);
|
Assert.That(inputFilter, Is.Not.Null, Localization.Cannot_open_specified_file);
|
||||||
|
|
||||||
string outputPath = Path.Combine(Path.GetTempPath(), SuggestedOutputFilename);
|
string outputPath = Path.Combine(Path.GetTempPath(), SuggestedOutputFilename);
|
||||||
|
|
||||||
Assert.IsFalse(File.Exists(outputPath), Localization.Output_file_already_exists_not_continuing);
|
Assert.That(File.Exists(outputPath), Is.False, Localization.Output_file_already_exists_not_continuing);
|
||||||
|
|
||||||
var inputFormat = ImageFormat.Detect(inputFilter) as IMediaImage;
|
var inputFormat = ImageFormat.Detect(inputFilter) as IMediaImage;
|
||||||
|
|
||||||
Assert.IsNotNull(inputFormat, Localization.Input_image_format_not_identified_not_proceeding_with_conversion);
|
Assert.That(inputFormat,
|
||||||
|
Is.Not.Null,
|
||||||
|
Localization.Input_image_format_not_identified_not_proceeding_with_conversion);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, inputFormat.Open(inputFilter), Localization.Unable_to_open_image_format);
|
Assert.That(inputFormat.Open(inputFilter),
|
||||||
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
|
Localization.Unable_to_open_image_format);
|
||||||
|
|
||||||
Assert.IsTrue(OutputFormat.SupportedMediaTypes.Contains(inputFormat.Info.MediaType),
|
Assert.That(OutputFormat.SupportedMediaTypes,
|
||||||
Localization.Output_format_does_not_support_media_type_cannot_continue);
|
Does.Contain(inputFormat.Info.MediaType),
|
||||||
|
Localization.Output_format_does_not_support_media_type_cannot_continue);
|
||||||
|
|
||||||
if(inputFormat.Info.ReadableSectorTags.Count == 0)
|
if(inputFormat.Info.ReadableSectorTags.Count == 0)
|
||||||
Assert.IsFalse(UseLong, Localization.Input_image_does_not_support_long_sectors);
|
Assert.That(UseLong, Is.False, Localization.Input_image_does_not_support_long_sectors);
|
||||||
|
|
||||||
var inputOptical = inputFormat as IOpticalMediaImage;
|
var inputOptical = inputFormat as IOpticalMediaImage;
|
||||||
var outputOptical = OutputFormat as IWritableOpticalImage;
|
var outputOptical = OutputFormat as IWritableOpticalImage;
|
||||||
|
|
||||||
Assert.IsNotNull(inputOptical, Localization.Could_not_treat_existing_image_as_optical_disc);
|
Assert.That(inputOptical, Is.Not.Null, Localization.Could_not_treat_existing_image_as_optical_disc);
|
||||||
Assert.IsNotNull(outputOptical, Localization.Could_not_treat_new_image_as_optical_disc);
|
Assert.That(outputOptical, Is.Not.Null, Localization.Could_not_treat_new_image_as_optical_disc);
|
||||||
Assert.IsNotNull(inputOptical.Tracks, Localization.Existing_image_contains_no_tracks);
|
Assert.That(inputOptical.Tracks, Is.Not.Null, Localization.Existing_image_contains_no_tracks);
|
||||||
|
|
||||||
Assert.IsTrue(outputOptical.Create(outputPath,
|
Assert.That(outputOptical.Create(outputPath,
|
||||||
inputFormat.Info.MediaType,
|
inputFormat.Info.MediaType,
|
||||||
ParsedOptions,
|
ParsedOptions,
|
||||||
inputFormat.Info.Sectors,
|
inputFormat.Info.Sectors,
|
||||||
inputFormat.Info.SectorSize),
|
inputFormat.Info.SectorSize),
|
||||||
string.Format(Localization.Error_0_creating_output_image, outputOptical.ErrorMessage));
|
string.Format(Localization.Error_0_creating_output_image, outputOptical.ErrorMessage));
|
||||||
|
|
||||||
var metadata = new ImageInfo
|
var metadata = new ImageInfo
|
||||||
{
|
{
|
||||||
@@ -104,8 +109,8 @@ public abstract class OpticalImageConvertIssueTest
|
|||||||
MediaTitle = inputFormat.Info.MediaTitle
|
MediaTitle = inputFormat.Info.MediaTitle
|
||||||
};
|
};
|
||||||
|
|
||||||
Assert.IsTrue(outputOptical.SetImageInfo(metadata),
|
Assert.That(outputOptical.SetImageInfo(metadata),
|
||||||
string.Format(Localization.Error_0_setting_metadata, outputOptical.ErrorMessage));
|
string.Format(Localization.Error_0_setting_metadata, outputOptical.ErrorMessage));
|
||||||
|
|
||||||
Metadata aaruMetadata = inputFormat.AaruMetadata;
|
Metadata aaruMetadata = inputFormat.AaruMetadata;
|
||||||
List<DumpHardware> dumpHardware = inputFormat.DumpHardware;
|
List<DumpHardware> dumpHardware = inputFormat.DumpHardware;
|
||||||
@@ -116,16 +121,16 @@ public abstract class OpticalImageConvertIssueTest
|
|||||||
AaruConsole.WriteLine(Localization.Converting_media_tag_0, mediaTag);
|
AaruConsole.WriteLine(Localization.Converting_media_tag_0, mediaTag);
|
||||||
errno = inputFormat.ReadMediaTag(mediaTag, out byte[] tag);
|
errno = inputFormat.ReadMediaTag(mediaTag, out byte[] tag);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, errno);
|
Assert.That(errno, Is.EqualTo(ErrorNumber.NoError));
|
||||||
Assert.IsTrue(outputOptical.WriteMediaTag(tag, mediaTag));
|
Assert.That(outputOptical.WriteMediaTag(tag, mediaTag));
|
||||||
}
|
}
|
||||||
|
|
||||||
AaruConsole.WriteLine(Localization._0_sectors_to_convert, inputFormat.Info.Sectors);
|
AaruConsole.WriteLine(Localization._0_sectors_to_convert, inputFormat.Info.Sectors);
|
||||||
ulong doneSectors;
|
ulong doneSectors;
|
||||||
|
|
||||||
Assert.IsTrue(outputOptical.SetTracks(inputOptical.Tracks),
|
Assert.That(outputOptical.SetTracks(inputOptical.Tracks),
|
||||||
string.Format(Localization.Error_0_sending_tracks_list_to_output_image,
|
string.Format(Localization.Error_0_sending_tracks_list_to_output_image,
|
||||||
outputOptical.ErrorMessage));
|
outputOptical.ErrorMessage));
|
||||||
|
|
||||||
foreach(Track track in inputOptical.Tracks)
|
foreach(Track track in inputOptical.Tracks)
|
||||||
{
|
{
|
||||||
@@ -172,17 +177,17 @@ public abstract class OpticalImageConvertIssueTest
|
|||||||
? inputFormat.ReadSector(doneSectors + track.StartSector, out sector)
|
? inputFormat.ReadSector(doneSectors + track.StartSector, out sector)
|
||||||
: inputFormat.ReadSectors(doneSectors + track.StartSector, sectorsToDo, out sector);
|
: inputFormat.ReadSectors(doneSectors + track.StartSector, sectorsToDo, out sector);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, errno);
|
Assert.That(errno, Is.EqualTo(ErrorNumber.NoError));
|
||||||
|
|
||||||
result = sectorsToDo == 1
|
result = sectorsToDo == 1
|
||||||
? outputOptical.WriteSector(sector, doneSectors + track.StartSector)
|
? outputOptical.WriteSector(sector, doneSectors + track.StartSector)
|
||||||
: outputOptical.WriteSectors(sector, doneSectors + track.StartSector, sectorsToDo);
|
: outputOptical.WriteSectors(sector, doneSectors + track.StartSector, sectorsToDo);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsTrue(result,
|
Assert.That(result,
|
||||||
string.Format(Localization.Error_0_writing_sector_1_not_continuing,
|
string.Format(Localization.Error_0_writing_sector_1_not_continuing,
|
||||||
outputOptical.ErrorMessage,
|
outputOptical.ErrorMessage,
|
||||||
doneSectors + track.StartSector));
|
doneSectors + track.StartSector));
|
||||||
|
|
||||||
doneSectors += sectorsToDo;
|
doneSectors += sectorsToDo;
|
||||||
}
|
}
|
||||||
@@ -282,15 +287,15 @@ public abstract class OpticalImageConvertIssueTest
|
|||||||
|
|
||||||
if(errno == ErrorNumber.NoData) continue;
|
if(errno == ErrorNumber.NoData) continue;
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(errno,
|
||||||
errno,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_reading_tag_not_continuing, errno));
|
string.Format(Localization.Error_0_reading_tag_not_continuing, errno));
|
||||||
|
|
||||||
result = outputOptical.WriteSectorTag(sector, track.Sequence, tag);
|
result = outputOptical.WriteSectorTag(sector, track.Sequence, tag);
|
||||||
|
|
||||||
Assert.IsTrue(result,
|
Assert.That(result,
|
||||||
string.Format(Localization.Error_0_writing_tag_not_continuing,
|
string.Format(Localization.Error_0_writing_tag_not_continuing,
|
||||||
outputOptical.ErrorMessage));
|
outputOptical.ErrorMessage));
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -308,9 +313,9 @@ public abstract class OpticalImageConvertIssueTest
|
|||||||
{
|
{
|
||||||
errno = inputFormat.ReadSectorTag(doneSectors + track.StartSector, tag, out sector);
|
errno = inputFormat.ReadSectorTag(doneSectors + track.StartSector, tag, out sector);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(errno,
|
||||||
errno,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_reading_tag_not_continuing, errno));
|
string.Format(Localization.Error_0_reading_tag_not_continuing, errno));
|
||||||
|
|
||||||
if(tag == SectorTagType.CdSectorSubchannel)
|
if(tag == SectorTagType.CdSectorSubchannel)
|
||||||
{
|
{
|
||||||
@@ -349,9 +354,9 @@ public abstract class OpticalImageConvertIssueTest
|
|||||||
tag,
|
tag,
|
||||||
out sector);
|
out sector);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(errno,
|
||||||
errno,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_reading_tag_not_continuing, errno));
|
string.Format(Localization.Error_0_reading_tag_not_continuing, errno));
|
||||||
|
|
||||||
if(tag == SectorTagType.CdSectorSubchannel)
|
if(tag == SectorTagType.CdSectorSubchannel)
|
||||||
{
|
{
|
||||||
@@ -389,10 +394,10 @@ public abstract class OpticalImageConvertIssueTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsTrue(result,
|
Assert.That(result,
|
||||||
string.Format(Localization.Error_0_writing_tag_for_sector_1_not_continuing,
|
string.Format(Localization.Error_0_writing_tag_for_sector_1_not_continuing,
|
||||||
outputOptical.ErrorMessage,
|
outputOptical.ErrorMessage,
|
||||||
doneSectors + track.StartSector));
|
doneSectors + track.StartSector));
|
||||||
|
|
||||||
doneSectors += sectorsToDo;
|
doneSectors += sectorsToDo;
|
||||||
}
|
}
|
||||||
@@ -406,8 +411,10 @@ public abstract class OpticalImageConvertIssueTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(trackFlags.Count > 0)
|
if(trackFlags.Count > 0)
|
||||||
|
{
|
||||||
foreach((byte track, byte flags) in trackFlags)
|
foreach((byte track, byte flags) in trackFlags)
|
||||||
outputOptical.WriteSectorTag([flags], track, SectorTagType.CdTrackFlags);
|
outputOptical.WriteSectorTag([flags], track, SectorTagType.CdTrackFlags);
|
||||||
|
}
|
||||||
|
|
||||||
if(mcn != null) outputOptical.WriteMediaTag(Encoding.UTF8.GetBytes(mcn), MediaTagType.CD_MCN);
|
if(mcn != null) outputOptical.WriteMediaTag(Encoding.UTF8.GetBytes(mcn), MediaTagType.CD_MCN);
|
||||||
|
|
||||||
@@ -425,7 +432,7 @@ public abstract class OpticalImageConvertIssueTest
|
|||||||
else if(aaruMetadata != null) outputOptical.SetMetadata(aaruMetadata);
|
else if(aaruMetadata != null) outputOptical.SetMetadata(aaruMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.True(outputOptical.Close(),
|
Assert.That(outputOptical.Close(),
|
||||||
string.Format(Localization.Error_0_closing_output_image_Contents_are_not_correct,
|
string.Format(Localization.Error_0_closing_output_image_Contents_are_not_correct,
|
||||||
outputOptical.ErrorMessage));
|
outputOptical.ErrorMessage));
|
||||||
|
|
||||||
@@ -434,7 +441,7 @@ public abstract class OpticalImageConvertIssueTest
|
|||||||
{
|
{
|
||||||
string md5 = Md5Context.File(outputPath, out _);
|
string md5 = Md5Context.File(outputPath, out _);
|
||||||
|
|
||||||
Assert.AreEqual(Md5, md5, Localization.Hashes_are_different);
|
Assert.That(md5, Is.EqualTo(Md5), Localization.Hashes_are_different);
|
||||||
}
|
}
|
||||||
|
|
||||||
File.Delete(outputPath);
|
File.Delete(outputPath);
|
||||||
|
|||||||
@@ -27,21 +27,23 @@ public abstract class OpticalImageReadIssueTest
|
|||||||
Environment.CurrentDirectory = DataFolder;
|
Environment.CurrentDirectory = DataFolder;
|
||||||
|
|
||||||
bool exists = File.Exists(TestFile);
|
bool exists = File.Exists(TestFile);
|
||||||
Assert.True(exists, Localization.Test_file_not_found);
|
Assert.That(exists, Localization.Test_file_not_found);
|
||||||
|
|
||||||
IFilter inputFilter = PluginRegister.Singleton.GetFilter(TestFile);
|
IFilter inputFilter = PluginRegister.Singleton.GetFilter(TestFile);
|
||||||
|
|
||||||
Assert.IsNotNull(inputFilter, Localization.Filter_for_test_file_is_not_detected);
|
Assert.That(inputFilter, Is.Not.Null, Localization.Filter_for_test_file_is_not_detected);
|
||||||
|
|
||||||
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
|
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
|
||||||
|
|
||||||
Assert.IsNotNull(image, Localization.Image_format_for_test_file_is_not_detected);
|
Assert.That(image, Is.Not.Null, Localization.Image_format_for_test_file_is_not_detected);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, image.Open(inputFilter), Localization.Cannot_open_image_for_test_file);
|
Assert.That(image.Open(inputFilter),
|
||||||
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
|
Localization.Cannot_open_image_for_test_file);
|
||||||
|
|
||||||
var opticalInput = image as IOpticalMediaImage;
|
var opticalInput = image as IOpticalMediaImage;
|
||||||
|
|
||||||
Assert.IsNotNull(opticalInput, Localization.Image_format_for_test_file_is_not_for_an_optical_disc);
|
Assert.That(opticalInput, Is.Not.Null, Localization.Image_format_for_test_file_is_not_for_an_optical_disc);
|
||||||
|
|
||||||
var ctx = new Crc32Context();
|
var ctx = new Crc32Context();
|
||||||
|
|
||||||
@@ -76,7 +78,7 @@ public abstract class OpticalImageReadIssueTest
|
|||||||
doneSectors += sectors - doneSectors;
|
doneSectors += sectors - doneSectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, errno);
|
Assert.That(errno, Is.EqualTo(ErrorNumber.NoError));
|
||||||
|
|
||||||
ctx.Update(sector);
|
ctx.Update(sector);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public abstract class PartitionSchemeTest
|
|||||||
Environment.CurrentDirectory = DataFolder;
|
Environment.CurrentDirectory = DataFolder;
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -38,15 +38,15 @@ public abstract class PartitionSchemeTest
|
|||||||
|
|
||||||
IFilter inputFilter = PluginRegister.Singleton.GetFilter(testFile);
|
IFilter inputFilter = PluginRegister.Singleton.GetFilter(testFile);
|
||||||
|
|
||||||
Assert.IsNotNull(inputFilter, string.Format(Localization.Filter_0, testFile));
|
Assert.That(inputFilter, Is.Not.Null, string.Format(Localization.Filter_0, testFile));
|
||||||
|
|
||||||
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
|
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
|
||||||
|
|
||||||
Assert.IsNotNull(image, string.Format(Localization.Image_format_0, testFile));
|
Assert.That(image, Is.Not.Null, string.Format(Localization.Image_format_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(image.Open(inputFilter),
|
||||||
image.Open(inputFilter),
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Cannot_open_image_for_0, testFile));
|
string.Format(Localization.Cannot_open_image_for_0, testFile));
|
||||||
|
|
||||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
string testFile = test.TestFile;
|
string testFile = test.TestFile;
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -48,10 +48,13 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
filter.Open(testFile);
|
filter.Open(testFile);
|
||||||
|
|
||||||
var image = Activator.CreateInstance(InputPlugin.GetType()) as IOpticalMediaImage;
|
var image = Activator.CreateInstance(InputPlugin.GetType()) as IOpticalMediaImage;
|
||||||
Assert.NotNull(image, string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
|
||||||
|
Assert.That(image,
|
||||||
|
Is.Not.Null,
|
||||||
|
string.Format(Localization.Could_not_instantiate_filesystem_for_0, testFile));
|
||||||
|
|
||||||
ErrorNumber opened = image.Open(filter);
|
ErrorNumber opened = image.Open(filter);
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_0, testFile));
|
Assert.That(opened, Is.EqualTo(ErrorNumber.NoError), string.Format(Localization.Open_0, testFile));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) continue;
|
if(opened != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
@@ -59,26 +62,26 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
{
|
{
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.AreEqual(test.Sectors,
|
Assert.That(image.Info.Sectors,
|
||||||
image.Info.Sectors,
|
Is.EqualTo(test.Sectors),
|
||||||
string.Format(Localization.Sectors_0, testFile));
|
string.Format(Localization.Sectors_0, testFile));
|
||||||
|
|
||||||
if(test.SectorSize > 0)
|
if(test.SectorSize > 0)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(test.SectorSize,
|
Assert.That(image.Info.SectorSize,
|
||||||
image.Info.SectorSize,
|
Is.EqualTo(test.SectorSize),
|
||||||
string.Format(Localization.Sector_size_0, testFile));
|
string.Format(Localization.Sector_size_0, testFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(test.MediaType,
|
Assert.That(image.Info.MediaType,
|
||||||
image.Info.MediaType,
|
Is.EqualTo(test.MediaType),
|
||||||
string.Format(Localization.Media_type_0, testFile));
|
string.Format(Localization.Media_type_0, testFile));
|
||||||
|
|
||||||
if(image.Info.MetadataMediaType != MetadataMediaType.OpticalDisc) return;
|
if(image.Info.MetadataMediaType != MetadataMediaType.OpticalDisc) return;
|
||||||
|
|
||||||
Assert.AreEqual(test.Tracks.Length,
|
Assert.That(image.Tracks,
|
||||||
image.Tracks.Count,
|
Has.Count.EqualTo(test.Tracks.Length),
|
||||||
string.Format(Localization.Tracks_0, testFile));
|
string.Format(Localization.Tracks_0, testFile));
|
||||||
|
|
||||||
image.Tracks.Select(t => t.Session)
|
image.Tracks.Select(t => t.Session)
|
||||||
.Should()
|
.Should()
|
||||||
@@ -125,11 +128,11 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
.BeEquivalentTo(test.Tracks.Select(s => s.Flags),
|
.BeEquivalentTo(test.Tracks.Select(s => s.Flags),
|
||||||
string.Format(Localization.Track_flags_0, testFile));
|
string.Format(Localization.Track_flags_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(latestEndSector,
|
Assert.That(image.Info.Sectors - 1,
|
||||||
image.Info.Sectors - 1,
|
Is.EqualTo(latestEndSector),
|
||||||
string.Format(Localization.Last_sector_for_tracks_is_0_but_it_is_1_for_image,
|
string.Format(Localization.Last_sector_for_tracks_is_0_but_it_is_1_for_image,
|
||||||
latestEndSector,
|
latestEndSector,
|
||||||
image.Info.Sectors));
|
image.Info.Sectors));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,7 +152,7 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
string testFile = test.TestFile;
|
string testFile = test.TestFile;
|
||||||
|
|
||||||
bool exists = File.Exists(testFile);
|
bool exists = File.Exists(testFile);
|
||||||
Assert.True(exists, string.Format(Localization._0_not_found, testFile));
|
Assert.That(exists, string.Format(Localization._0_not_found, testFile));
|
||||||
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
// It arrives here...
|
// It arrives here...
|
||||||
@@ -160,11 +163,12 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
|
|
||||||
var inputFormat = Activator.CreateInstance(InputPlugin.GetType()) as IOpticalMediaImage;
|
var inputFormat = Activator.CreateInstance(InputPlugin.GetType()) as IOpticalMediaImage;
|
||||||
|
|
||||||
Assert.NotNull(inputFormat,
|
Assert.That(inputFormat,
|
||||||
string.Format(Localization.Could_not_instantiate_input_plugin_for_0, testFile));
|
Is.Not.Null,
|
||||||
|
string.Format(Localization.Could_not_instantiate_input_plugin_for_0, testFile));
|
||||||
|
|
||||||
ErrorNumber opened = inputFormat.Open(filter);
|
ErrorNumber opened = inputFormat.Open(filter);
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_0, testFile));
|
Assert.That(opened, Is.EqualTo(ErrorNumber.NoError), string.Format(Localization.Open_0, testFile));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) continue;
|
if(opened != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
@@ -172,13 +176,16 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
|
|
||||||
var outputFormat = Activator.CreateInstance(OutputPlugin.GetType()) as IWritableOpticalImage;
|
var outputFormat = Activator.CreateInstance(OutputPlugin.GetType()) as IWritableOpticalImage;
|
||||||
|
|
||||||
Assert.NotNull(outputFormat,
|
Assert.That(outputFormat,
|
||||||
string.Format(Localization.Could_not_instantiate_output_plugin_for_0, testFile));
|
Is.Not.Null,
|
||||||
|
string.Format(Localization.Could_not_instantiate_output_plugin_for_0, testFile));
|
||||||
|
|
||||||
Assert.IsTrue(outputFormat.SupportedMediaTypes.Contains(inputFormat.Info.MediaType),
|
|
||||||
string.Format(Localization.Trying_to_convert_unsupported_media_type_0_for_1,
|
Assert.That(outputFormat.SupportedMediaTypes,
|
||||||
inputFormat.Info.MediaType,
|
Does.Contain(inputFormat.Info.MediaType),
|
||||||
testFile));
|
string.Format(Localization.Trying_to_convert_unsupported_media_type_0_for_1,
|
||||||
|
inputFormat.Info.MediaType,
|
||||||
|
testFile));
|
||||||
|
|
||||||
bool useLong = inputFormat.Info.ReadableSectorTags.Except(new[]
|
bool useLong = inputFormat.Info.ReadableSectorTags.Except(new[]
|
||||||
{
|
{
|
||||||
@@ -196,12 +203,12 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
sectorTag != SectorTagType.CdSectorSubchannel))
|
sectorTag != SectorTagType.CdSectorSubchannel))
|
||||||
useLong = false;
|
useLong = false;
|
||||||
|
|
||||||
Assert.IsTrue(outputFormat.Create(outputPath,
|
Assert.That(outputFormat.Create(outputPath,
|
||||||
inputFormat.Info.MediaType,
|
inputFormat.Info.MediaType,
|
||||||
new Dictionary<string, string>(),
|
new Dictionary<string, string>(),
|
||||||
inputFormat.Info.Sectors,
|
inputFormat.Info.Sectors,
|
||||||
inputFormat.Info.SectorSize),
|
inputFormat.Info.SectorSize),
|
||||||
string.Format(Localization.Error_0_creating_output_image, outputFormat.ErrorMessage));
|
string.Format(Localization.Error_0_creating_output_image, outputFormat.ErrorMessage));
|
||||||
|
|
||||||
foreach(MediaTagType mediaTag in inputFormat.Info.ReadableMediaTags.Where(mediaTag =>
|
foreach(MediaTagType mediaTag in inputFormat.Info.ReadableMediaTags.Where(mediaTag =>
|
||||||
outputFormat.SupportedMediaTags.Contains(mediaTag)))
|
outputFormat.SupportedMediaTags.Contains(mediaTag)))
|
||||||
@@ -210,9 +217,9 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
outputFormat.WriteMediaTag(buffer, mediaTag);
|
outputFormat.WriteMediaTag(buffer, mediaTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsTrue(outputFormat.SetTracks(inputFormat.Tracks),
|
Assert.That(outputFormat.SetTracks(inputFormat.Tracks),
|
||||||
string.Format(Localization.Error_0_sending_tracks_list_to_output_image,
|
string.Format(Localization.Error_0_sending_tracks_list_to_output_image,
|
||||||
outputFormat.ErrorMessage));
|
outputFormat.ErrorMessage));
|
||||||
|
|
||||||
ulong doneSectors;
|
ulong doneSectors;
|
||||||
|
|
||||||
@@ -265,7 +272,7 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
sectorsToDo,
|
sectorsToDo,
|
||||||
out sector);
|
out sector);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, errno);
|
Assert.That(errno, Is.EqualTo(ErrorNumber.NoError));
|
||||||
|
|
||||||
result = sectorsToDo == 1
|
result = sectorsToDo == 1
|
||||||
? outputFormat.WriteSector(sector, doneSectors + track.StartSector)
|
? outputFormat.WriteSector(sector, doneSectors + track.StartSector)
|
||||||
@@ -274,10 +281,10 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
sectorsToDo);
|
sectorsToDo);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsTrue(result,
|
Assert.That(result,
|
||||||
string.Format(Localization.Error_0_writing_sector_1,
|
string.Format(Localization.Error_0_writing_sector_1,
|
||||||
outputFormat.ErrorMessage,
|
outputFormat.ErrorMessage,
|
||||||
doneSectors + track.StartSector));
|
doneSectors + track.StartSector));
|
||||||
|
|
||||||
doneSectors += sectorsToDo;
|
doneSectors += sectorsToDo;
|
||||||
}
|
}
|
||||||
@@ -378,15 +385,15 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
case SectorTagType.CdTrackIsrc:
|
case SectorTagType.CdTrackIsrc:
|
||||||
errno = inputFormat.ReadSectorTag(track.Sequence, tag, out sector);
|
errno = inputFormat.ReadSectorTag(track.Sequence, tag, out sector);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(errno,
|
||||||
errno,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_reading_tag_not_continuing, errno));
|
string.Format(Localization.Error_0_reading_tag_not_continuing, errno));
|
||||||
|
|
||||||
result = outputFormat.WriteSectorTag(sector, track.Sequence, tag);
|
result = outputFormat.WriteSectorTag(sector, track.Sequence, tag);
|
||||||
|
|
||||||
Assert.IsTrue(result,
|
Assert.That(result,
|
||||||
string.Format(Localization.Error_0_writing_tag_not_continuing,
|
string.Format(Localization.Error_0_writing_tag_not_continuing,
|
||||||
outputFormat.ErrorMessage));
|
outputFormat.ErrorMessage));
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -404,9 +411,9 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
{
|
{
|
||||||
errno = inputFormat.ReadSectorTag(doneSectors + track.StartSector, tag, out sector);
|
errno = inputFormat.ReadSectorTag(doneSectors + track.StartSector, tag, out sector);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(errno,
|
||||||
errno,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_reading_tag_not_continuing, errno));
|
string.Format(Localization.Error_0_reading_tag_not_continuing, errno));
|
||||||
|
|
||||||
if(tag == SectorTagType.CdSectorSubchannel)
|
if(tag == SectorTagType.CdSectorSubchannel)
|
||||||
{
|
{
|
||||||
@@ -445,9 +452,9 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
tag,
|
tag,
|
||||||
out sector);
|
out sector);
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError,
|
Assert.That(errno,
|
||||||
errno,
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
string.Format(Localization.Error_0_reading_tag_not_continuing, errno));
|
string.Format(Localization.Error_0_reading_tag_not_continuing, errno));
|
||||||
|
|
||||||
if(tag == SectorTagType.CdSectorSubchannel)
|
if(tag == SectorTagType.CdSectorSubchannel)
|
||||||
{
|
{
|
||||||
@@ -485,10 +492,10 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsTrue(result,
|
Assert.That(result,
|
||||||
string.Format(Localization.Error_0_writing_tag_for_sector_1_not_continuing,
|
string.Format(Localization.Error_0_writing_tag_for_sector_1_not_continuing,
|
||||||
outputFormat.ErrorMessage,
|
outputFormat.ErrorMessage,
|
||||||
doneSectors + track.StartSector));
|
doneSectors + track.StartSector));
|
||||||
|
|
||||||
doneSectors += sectorsToDo;
|
doneSectors += sectorsToDo;
|
||||||
}
|
}
|
||||||
@@ -506,8 +513,10 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(trackFlags.Count > 0)
|
if(trackFlags.Count > 0)
|
||||||
|
{
|
||||||
foreach((byte track, byte flags) in trackFlags)
|
foreach((byte track, byte flags) in trackFlags)
|
||||||
outputFormat.WriteSectorTag([flags], track, SectorTagType.CdTrackFlags);
|
outputFormat.WriteSectorTag([flags], track, SectorTagType.CdTrackFlags);
|
||||||
|
}
|
||||||
|
|
||||||
if(mcn != null) outputFormat.WriteMediaTag(Encoding.UTF8.GetBytes(mcn), MediaTagType.CD_MCN);
|
if(mcn != null) outputFormat.WriteMediaTag(Encoding.UTF8.GetBytes(mcn), MediaTagType.CD_MCN);
|
||||||
|
|
||||||
@@ -565,9 +574,9 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
outputFormat);
|
outputFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsTrue(outputFormat.Close(),
|
Assert.That(outputFormat.Close(),
|
||||||
string.Format(Localization.Error_0_closing_output_image_Contents_are_not_correct,
|
string.Format(Localization.Error_0_closing_output_image_Contents_are_not_correct,
|
||||||
outputFormat.ErrorMessage));
|
outputFormat.ErrorMessage));
|
||||||
|
|
||||||
filter = PluginRegister.Singleton.GetFilter(outputPath);
|
filter = PluginRegister.Singleton.GetFilter(outputPath);
|
||||||
filter.Open(outputPath);
|
filter.Open(outputPath);
|
||||||
@@ -576,10 +585,16 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
Environment.CurrentDirectory = tmpFolder;
|
Environment.CurrentDirectory = tmpFolder;
|
||||||
|
|
||||||
var image = Activator.CreateInstance(OutputPlugin.GetType()) as IOpticalMediaImage;
|
var image = Activator.CreateInstance(OutputPlugin.GetType()) as IOpticalMediaImage;
|
||||||
Assert.NotNull(image, string.Format(Localization.Could_not_instantiate_output_plugin_for_0, testFile));
|
|
||||||
|
Assert.That(image,
|
||||||
|
Is.Not.Null,
|
||||||
|
string.Format(Localization.Could_not_instantiate_output_plugin_for_0, testFile));
|
||||||
|
|
||||||
opened = image.Open(filter);
|
opened = image.Open(filter);
|
||||||
Assert.AreEqual(ErrorNumber.NoError, opened, string.Format(Localization.Open_created_0, testFile));
|
|
||||||
|
Assert.That(opened,
|
||||||
|
Is.EqualTo(ErrorNumber.NoError),
|
||||||
|
string.Format(Localization.Open_created_0, testFile));
|
||||||
|
|
||||||
if(opened != ErrorNumber.NoError) continue;
|
if(opened != ErrorNumber.NoError) continue;
|
||||||
|
|
||||||
@@ -587,20 +602,20 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
{
|
{
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.AreEqual(test.Sectors,
|
Assert.That(image.Info.Sectors,
|
||||||
image.Info.Sectors,
|
Is.EqualTo(test.Sectors),
|
||||||
string.Format(Localization.Sectors_output_0, testFile));
|
string.Format(Localization.Sectors_output_0, testFile));
|
||||||
|
|
||||||
if(test.SectorSize > 0)
|
if(test.SectorSize > 0)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(test.SectorSize,
|
Assert.That(image.Info.SectorSize,
|
||||||
image.Info.SectorSize,
|
Is.EqualTo(test.SectorSize),
|
||||||
string.Format(Localization.Sector_size_output_0, testFile));
|
string.Format(Localization.Sector_size_output_0, testFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(test.Tracks.Length,
|
Assert.That(image.Tracks,
|
||||||
image.Tracks.Count,
|
Has.Count.EqualTo(test.Tracks.Length),
|
||||||
string.Format(Localization.Tracks_output_0, testFile));
|
string.Format(Localization.Tracks_output_0, testFile));
|
||||||
|
|
||||||
image.Tracks.Select(t => t.Session)
|
image.Tracks.Select(t => t.Session)
|
||||||
.Should()
|
.Should()
|
||||||
@@ -647,12 +662,11 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
.BeEquivalentTo(test.Tracks.Select(s => s.Flags),
|
.BeEquivalentTo(test.Tracks.Select(s => s.Flags),
|
||||||
string.Format(Localization.Track_flags_output_0, testFile));
|
string.Format(Localization.Track_flags_output_0, testFile));
|
||||||
|
|
||||||
Assert.AreEqual(latestEndSector,
|
Assert.That(image.Info.Sectors - 1,
|
||||||
image.Info.Sectors - 1,
|
Is.EqualTo(latestEndSector),
|
||||||
string.Format(Localization
|
string.Format(Localization.Last_sector_for_tracks_is_0_but_it_is_1_for_image_output,
|
||||||
.Last_sector_for_tracks_is_0_but_it_is_1_for_image_output,
|
latestEndSector,
|
||||||
latestEndSector,
|
image.Info.Sectors));
|
||||||
image.Info.Sectors));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -703,17 +717,17 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
doneSectors += sectors - doneSectors;
|
doneSectors += sectors - doneSectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, errno);
|
Assert.That(errno, Is.EqualTo(ErrorNumber.NoError));
|
||||||
|
|
||||||
ctx.Update(sector);
|
ctx.Update(sector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(@long ? test.LongMd5 : test.Md5,
|
Assert.That(ctx.End(),
|
||||||
ctx.End(),
|
Is.EqualTo(@long ? test.LongMd5 : test.Md5),
|
||||||
string.Format("{0}: {1}",
|
string.Format("{0}: {1}",
|
||||||
@long ? Localization.Long_hash_output : Localization.Hash_output,
|
@long ? Localization.Long_hash_output : Localization.Hash_output,
|
||||||
testFile));
|
testFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel)) return;
|
if(!image.Info.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel)) return;
|
||||||
@@ -750,15 +764,15 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
|||||||
doneSectors += sectors - doneSectors;
|
doneSectors += sectors - doneSectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(ErrorNumber.NoError, errno);
|
Assert.That(errno, Is.EqualTo(ErrorNumber.NoError));
|
||||||
|
|
||||||
ctx.Update(sector);
|
ctx.Update(sector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.AreEqual(test.SubchannelMd5,
|
Assert.That(ctx.End(),
|
||||||
ctx.End(),
|
Is.EqualTo(test.SubchannelMd5),
|
||||||
string.Format(Localization.Subchannel_hash_output_0, testFile));
|
string.Format(Localization.Subchannel_hash_output_0, testFile));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -343,6 +343,51 @@
|
|||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=WithExpressionInsteadOfInitializer/@EntryIndexedValue">WARNING</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=WithExpressionInsteadOfInitializer/@EntryIndexedValue">WARNING</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=WrongIndentSize/@EntryIndexedValue">WARNING</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=WrongIndentSize/@EntryIndexedValue">WARNING</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/UseCollectionExpression/ConvertEmptyCollection/@EntryValue">SUGGESTION</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/UseCollectionExpression/ConvertEmptyCollection/@EntryValue">SUGGESTION</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2001/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2002/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2004/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2005/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2006/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2007/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2008/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2009/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2010/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2011/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2012/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2013/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2015/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2016/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2017/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2019/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2020/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2021/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2022/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2023/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2024/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2025/@EntryIndexedValue">WARNING</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2026/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2027/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2028/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2029/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2030/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2031/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2032/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2033/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2034/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2035/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2036/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2037/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2038/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2039/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2040/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2041/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2043/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2044/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2045/@EntryIndexedValue">WARNING</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2047/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2048/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2049/@EntryIndexedValue">ERROR</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Roslyn/RoslynCustomSeverities/=NUnit2050/@EntryIndexedValue">ERROR</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CppCodeStyle/BracesInForStatement/@EntryValue">RequiredForMultiline</s:String>
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CppCodeStyle/BracesInForStatement/@EntryValue">RequiredForMultiline</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CppCodeStyle/BracesInIfStatement/@EntryValue">RequiredForMultiline</s:String>
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CppCodeStyle/BracesInIfStatement/@EntryValue">RequiredForMultiline</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CppCodeStyle/BracesInWhileStatement/@EntryValue">RequiredForMultiline</s:String>
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CppCodeStyle/BracesInWhileStatement/@EntryValue">RequiredForMultiline</s:String>
|
||||||
|
|||||||
Reference in New Issue
Block a user