Style cleanup
This commit is contained in:
@@ -11,8 +11,7 @@ namespace PkmnLib.Tests.Static;
|
||||
|
||||
public class DeepCloneTests
|
||||
{
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
[SuppressMessage("ReSharper", "ValueParameterNotUsed")]
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local"), SuppressMessage("ReSharper", "ValueParameterNotUsed")]
|
||||
private class TestClass : IDeepCloneable
|
||||
{
|
||||
public int Value { get; set; }
|
||||
@@ -70,8 +69,7 @@ public class DeepCloneTests
|
||||
var clone = obj.DeepClone();
|
||||
await Assert.That(clone).IsNotEqualTo(obj);
|
||||
var clonePrivateField =
|
||||
clone.GetType().GetField("_privateField", BindingFlags.NonPublic | BindingFlags.Instance)!
|
||||
.GetValue(clone);
|
||||
clone.GetType().GetField("_privateField", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(clone);
|
||||
await Assert.That(clonePrivateField).IsEqualTo(1);
|
||||
}
|
||||
|
||||
@@ -93,28 +91,24 @@ public class DeepCloneTests
|
||||
await Assert.That(library.StaticLibrary.Species.TryGet("bulbasaur", out var bulbasaur)).IsTrue();
|
||||
await Assert.That(library.StaticLibrary.Species.TryGet("charmander", out var charmander)).IsTrue();
|
||||
var party1 = new PokemonParty(6);
|
||||
party1.SwapInto(new PokemonImpl(library, bulbasaur!,
|
||||
bulbasaur!.GetDefaultForm(), new AbilityIndex
|
||||
{
|
||||
IsHidden = false,
|
||||
Index = 0,
|
||||
}, 50, 0,
|
||||
Gender.Male, 0, "hardy"), 0);
|
||||
party1.SwapInto(new PokemonImpl(library, bulbasaur!, bulbasaur!.GetDefaultForm(), new AbilityIndex
|
||||
{
|
||||
IsHidden = false,
|
||||
Index = 0,
|
||||
}, 50, 0, Gender.Male, 0, "hardy"), 0);
|
||||
var party2 = new PokemonParty(6);
|
||||
party2.SwapInto(new PokemonImpl(library, charmander!,
|
||||
charmander!.GetDefaultForm(), new AbilityIndex
|
||||
{
|
||||
IsHidden = false,
|
||||
Index = 0,
|
||||
}, 50, 0,
|
||||
Gender.Male, 0, "hardy"), 0);
|
||||
party2.SwapInto(new PokemonImpl(library, charmander!, charmander!.GetDefaultForm(), new AbilityIndex
|
||||
{
|
||||
IsHidden = false,
|
||||
Index = 0,
|
||||
}, 50, 0, Gender.Male, 0, "hardy"), 0);
|
||||
|
||||
var parties = new[]
|
||||
{
|
||||
new BattlePartyImpl(party1, [new ResponsibleIndex(0, 0)]),
|
||||
new BattlePartyImpl(party2, [new ResponsibleIndex(1, 0)]),
|
||||
};
|
||||
var battle = new BattleImpl(library, parties, false, 2, 3, randomSeed: 0);
|
||||
var battle = new BattleImpl(library, parties, false, 2, 3, 0);
|
||||
battle.Sides[0].SwapPokemon(0, party1[0]);
|
||||
battle.Sides[1].SwapPokemon(0, party2[0]);
|
||||
party1[0]!.ChangeStatBoost(Statistic.Defense, 2, true);
|
||||
|
||||
@@ -10,21 +10,23 @@ public class GrowthRateTests
|
||||
Action act = () => _ = new LookupGrowthRate("Test", []);
|
||||
act.Should().Throw<ArgumentException>().WithMessage("Experience table must have at least one entry.");
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void NonZeroLookupGrowthRateTestShouldThrowArgumentException()
|
||||
{
|
||||
Action act = () => _ = new LookupGrowthRate("Test", [1]);
|
||||
act.Should().Throw<ArgumentException>().WithMessage("Experience table must start at 0.");
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TooLargeLookupGrowthRateTestShouldThrowArgumentException()
|
||||
{
|
||||
Action act = () => _ = new LookupGrowthRate("Test", Enumerable.Range(0, LevelInt.MaxValue + 1).Select(i => (uint)i));
|
||||
act.Should().Throw<ArgumentException>().WithMessage($"Experience table may have at most {LevelInt.MaxValue} entries.");
|
||||
Action act = () =>
|
||||
_ = new LookupGrowthRate("Test", Enumerable.Range(0, LevelInt.MaxValue + 1).Select(i => (uint)i));
|
||||
act.Should().Throw<ArgumentException>()
|
||||
.WithMessage($"Experience table may have at most {LevelInt.MaxValue} entries.");
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void LookupGrowthRateTest()
|
||||
{
|
||||
@@ -35,7 +37,7 @@ public class GrowthRateTests
|
||||
growthRate.CalculateLevel(3).Should().Be(4);
|
||||
growthRate.CalculateLevel(4).Should().Be(5);
|
||||
growthRate.CalculateLevel(5).Should().Be(6);
|
||||
|
||||
|
||||
growthRate.CalculateExperience(1).Should().Be(0);
|
||||
growthRate.CalculateExperience(2).Should().Be(1);
|
||||
growthRate.CalculateExperience(3).Should().Be(2);
|
||||
|
||||
@@ -15,8 +15,7 @@ public class StringKeyTests
|
||||
yield return () => ("TeSt", "tesv", false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[MethodDataSource(nameof(StringKeyEqualityTestCases))]
|
||||
[Test, MethodDataSource(nameof(StringKeyEqualityTestCases))]
|
||||
public async Task StringKeyEqualityTest(string k1, string k2, bool expected)
|
||||
{
|
||||
var sk1 = new StringKey(k1);
|
||||
@@ -24,8 +23,7 @@ public class StringKeyTests
|
||||
await Assert.That(sk1 == sk2).IsEqualTo(expected);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[MethodDataSource(nameof(StringKeyEqualityTestCases))]
|
||||
[Test, MethodDataSource(nameof(StringKeyEqualityTestCases))]
|
||||
public async Task HashCodeEqualityTest(string k1, string k2, bool expected)
|
||||
{
|
||||
var sk1 = new StringKey(k1);
|
||||
@@ -33,8 +31,7 @@ public class StringKeyTests
|
||||
await Assert.That(sk1.GetHashCode() == sk2.GetHashCode()).IsEqualTo(expected);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[MethodDataSource(nameof(StringKeyEqualityTestCases))]
|
||||
[Test, MethodDataSource(nameof(StringKeyEqualityTestCases))]
|
||||
public async Task HashSetEqualityTest(string k1, string k2, bool expected)
|
||||
{
|
||||
var sk1 = new StringKey(k1);
|
||||
|
||||
Reference in New Issue
Block a user