Remove FluentAssertions

This commit is contained in:
Deukhoofd 2025-05-03 13:32:26 +02:00
parent 0d869a0cc6
commit 4d5dfd0342
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
3 changed files with 25 additions and 25 deletions

View File

@ -1,4 +1,3 @@
global using TUnit;
global using NSubstitute;
global using FluentAssertions;
global using LevelInt = byte;

View File

@ -11,7 +11,6 @@
<ItemGroup>
<PackageReference Include="CSPath" Version="0.0.4"/>
<PackageReference Include="FluentAssertions" Version="8.2.0"/>
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@ -1,48 +1,50 @@
using PkmnLib.Static;
using TUnit.Assertions.AssertConditions.Throws;
namespace PkmnLib.Tests.Static;
public class GrowthRateTests
{
[Test]
public void EmptyLookupGrowthRateTestShouldThrowArgumentException()
public async Task EmptyLookupGrowthRateTestShouldThrowArgumentException()
{
Action act = () => _ = new LookupGrowthRate("Test", []);
act.Should().Throw<ArgumentException>().WithMessage("Experience table must have at least one entry.");
await Assert.That(() => { _ = new LookupGrowthRate("Test", []); }).Throws<ArgumentException>()
.WithMessage("Experience table must have at least one entry.");
}
[Test]
public void NonZeroLookupGrowthRateTestShouldThrowArgumentException()
public async Task NonZeroLookupGrowthRateTestShouldThrowArgumentException()
{
Action act = () => _ = new LookupGrowthRate("Test", [1]);
act.Should().Throw<ArgumentException>().WithMessage("Experience table must start at 0.");
await Assert.That(() => { _ = new LookupGrowthRate("Test", [1]); }).Throws<ArgumentException>()
.WithMessage("Experience table must start at 0.");
}
[Test]
public void TooLargeLookupGrowthRateTestShouldThrowArgumentException()
public async Task TooLargeLookupGrowthRateTestShouldThrowArgumentException()
{
Action act = () =>
_ = new LookupGrowthRate("Test", Enumerable.Range(0, LevelInt.MaxValue + 1).Select(i => (uint)i));
act.Should().Throw<ArgumentException>()
await Assert.That(() =>
{
_ = new LookupGrowthRate("Test", Enumerable.Range(0, LevelInt.MaxValue + 1).Select(i => (uint)i));
}).Throws<ArgumentException>()
.WithMessage($"Experience table may have at most {LevelInt.MaxValue} entries.");
}
[Test]
public void LookupGrowthRateTest()
public async Task LookupGrowthRateTest()
{
var growthRate = new LookupGrowthRate("Test", [0, 1, 2, 3, 4, 5]);
growthRate.CalculateLevel(0).Should().Be(1);
growthRate.CalculateLevel(1).Should().Be(2);
growthRate.CalculateLevel(2).Should().Be(3);
growthRate.CalculateLevel(3).Should().Be(4);
growthRate.CalculateLevel(4).Should().Be(5);
growthRate.CalculateLevel(5).Should().Be(6);
await Assert.That(growthRate.CalculateLevel(0)).IsEqualTo((LevelInt)1);
await Assert.That(growthRate.CalculateLevel(1)).IsEqualTo((LevelInt)2);
await Assert.That(growthRate.CalculateLevel(2)).IsEqualTo((LevelInt)3);
await Assert.That(growthRate.CalculateLevel(3)).IsEqualTo((LevelInt)4);
await Assert.That(growthRate.CalculateLevel(4)).IsEqualTo((LevelInt)5);
await Assert.That(growthRate.CalculateLevel(5)).IsEqualTo((LevelInt)6);
growthRate.CalculateExperience(1).Should().Be(0);
growthRate.CalculateExperience(2).Should().Be(1);
growthRate.CalculateExperience(3).Should().Be(2);
growthRate.CalculateExperience(4).Should().Be(3);
growthRate.CalculateExperience(5).Should().Be(4);
growthRate.CalculateExperience(6).Should().Be(5);
await Assert.That(growthRate.CalculateExperience(1)).IsEqualTo((uint)0);
await Assert.That(growthRate.CalculateExperience(2)).IsEqualTo((uint)1);
await Assert.That(growthRate.CalculateExperience(3)).IsEqualTo((uint)2);
await Assert.That(growthRate.CalculateExperience(4)).IsEqualTo((uint)3);
await Assert.That(growthRate.CalculateExperience(5)).IsEqualTo((uint)4);
await Assert.That(growthRate.CalculateExperience(6)).IsEqualTo((uint)5);
}
}