Skip to content

Commit

Permalink
Update NUnit.
Browse files Browse the repository at this point in the history
  • Loading branch information
claunia committed May 2, 2024
1 parent b9bbca1 commit 47cc43a
Show file tree
Hide file tree
Showing 42 changed files with 1,150 additions and 1,017 deletions.
6 changes: 5 additions & 1 deletion Aaru.Tests/Aaru.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
<ItemGroup>
<PackageReference Include="Claunia.Encoding" Version="1.9.2"/>
<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="Microsoft.NET.Test.Sdk" Version="17.9.0"/>
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0"/>
Expand Down
6 changes: 3 additions & 3 deletions Aaru.Tests/Checksums/SHA512.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ public void RandomData()
fs.Close();
fs.Dispose();
Sha512Context.Data(data, out byte[] result);
Assert.AreEqual(_expectedRandom, result);
Assert.That(result, Is.EqualTo(_expectedRandom));
}

[Test]
public void RandomFile()
{
byte[] result = Sha512Context.File(Path.Combine(Consts.TestFilesRoot, "Checksum test files", "random"));
Assert.AreEqual(_expectedRandom, result);
Assert.That(result, Is.EqualTo(_expectedRandom));
}

[Test]
Expand All @@ -132,6 +132,6 @@ public void RandomInstance()
IChecksum ctx = new Sha512Context();
ctx.Update(data);
byte[] result = ctx.Final();
Assert.AreEqual(_expectedRandom, result);
Assert.That(result, Is.EqualTo(_expectedRandom));
}
}
8 changes: 4 additions & 4 deletions Aaru.Tests/Checksums/SpamSum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void EmptyData()
fs.Close();
fs.Dispose();
string result = SpamSumContext.Data(data, out _);
Assert.AreEqual(EXPECTED_EMPTY, result);
Assert.That(result, Is.EqualTo(EXPECTED_EMPTY));
}

[Test]
Expand All @@ -71,7 +71,7 @@ public void EmptyInstance()
IChecksum ctx = new SpamSumContext();
ctx.Update(data);
string result = ctx.End();
Assert.AreEqual(EXPECTED_EMPTY, result);
Assert.That(result, Is.EqualTo(EXPECTED_EMPTY));
}

[Test]
Expand All @@ -87,7 +87,7 @@ public void RandomData()
fs.Close();
fs.Dispose();
string result = SpamSumContext.Data(data, out _);
Assert.AreEqual(EXPECTED_RANDOM, result);
Assert.That(result, Is.EqualTo(EXPECTED_RANDOM));
}

[Test]
Expand All @@ -105,6 +105,6 @@ public void RandomInstance()
IChecksum ctx = new SpamSumContext();
ctx.Update(data);
string result = ctx.End();
Assert.AreEqual(EXPECTED_RANDOM, result);
Assert.That(result, Is.EqualTo(EXPECTED_RANDOM));
}
}
20 changes: 10 additions & 10 deletions Aaru.Tests/Devices/IomegaJaz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,25 @@ public void Info()
var image = new ZZZRawImage();
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;

using(new AssertionScope())
{
Assert.Multiple(() =>
{
Assert.AreEqual(_sectors[i],
image.Info.Sectors,
string.Format(Localization.Sectors_0, _testFiles[i]));
Assert.That(image.Info.Sectors,
Is.EqualTo(_sectors[i]),
string.Format(Localization.Sectors_0, _testFiles[i]));

Assert.AreEqual(_sectorSize[i],
image.Info.SectorSize,
string.Format(Localization.Sector_size_0, _testFiles[i]));
Assert.That(image.Info.SectorSize,
Is.EqualTo(_sectorSize[i]),
string.Format(Localization.Sector_size_0, _testFiles[i]));

Assert.AreEqual(_mediaTypes[i],
image.Info.MediaType,
string.Format(Localization.Media_type_0, _testFiles[i]));
Assert.That(image.Info.MediaType,
Is.EqualTo(_mediaTypes[i]),
string.Format(Localization.Media_type_0, _testFiles[i]));
});
}
}
Expand Down
20 changes: 10 additions & 10 deletions Aaru.Tests/Devices/LS120.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,25 @@ public void Info()
var image = new ZZZRawImage();
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;

using(new AssertionScope())
{
Assert.Multiple(() =>
{
Assert.AreEqual(_sectors[i],
image.Info.Sectors,
string.Format(Localization.Sectors_0, _testFiles[i]));
Assert.That(image.Info.Sectors,
Is.EqualTo(_sectors[i]),
string.Format(Localization.Sectors_0, _testFiles[i]));

Assert.AreEqual(_sectorSize[i],
image.Info.SectorSize,
string.Format(Localization.Sector_size_0, _testFiles[i]));
Assert.That(image.Info.SectorSize,
Is.EqualTo(_sectorSize[i]),
string.Format(Localization.Sector_size_0, _testFiles[i]));

Assert.AreEqual(_mediaTypes[i],
image.Info.MediaType,
string.Format(Localization.Media_type_0, _testFiles[i]));
Assert.That(image.Info.MediaType,
Is.EqualTo(_mediaTypes[i]),
string.Format(Localization.Media_type_0, _testFiles[i]));
});
}
}
Expand Down
40 changes: 21 additions & 19 deletions Aaru.Tests/Devices/MultiMediaCard/CID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,33 +40,35 @@ public void Test()
Assert.Multiple(() =>
{
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);
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],
cid.Manufacturer,
string.Format(Localization.Manufacturer_0, cards[i]));
Assert.That(cid.Manufacturer,
Is.EqualTo(manufacturers[i]),
string.Format(Localization.Manufacturer_0, cards[i]));

Assert.AreEqual(applications[i],
cid.ApplicationID,
string.Format(Localization.Application_ID_0, cards[i]));
Assert.That(cid.ApplicationID,
Is.EqualTo(applications[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],
cid.ProductRevision,
string.Format(Localization.Product_revision_0, cards[i]));
Assert.That(cid.ProductRevision,
Is.EqualTo(revisions[i]),
string.Format(Localization.Product_revision_0, cards[i]));

Assert.AreEqual(serials[i],
cid.ProductSerialNumber,
string.Format(Localization.Serial_number_0, cards[i]));
Assert.That(cid.ProductSerialNumber,
Is.EqualTo(serials[i]),
string.Format(Localization.Serial_number_0, cards[i]));

Assert.AreEqual(dates[i],
cid.ManufacturingDate,
string.Format(Localization.Manufacturing_date_0, cards[i]));
Assert.That(cid.ManufacturingDate,
Is.EqualTo(dates[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]));
});
}
}
Expand Down
Loading

0 comments on commit 47cc43a

Please sign in to comment.