Update TUnit, warning cleanup
Some checks failed
Build / Build (push) Failing after 35s

This commit is contained in:
2026-07-05 13:24:22 +02:00
parent 16a1990486
commit cc091d5327
61 changed files with 113 additions and 190 deletions

View File

@@ -2,7 +2,6 @@ using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Pcg;
using PkmnLib.Dynamic.Models;
using PkmnLib.Plugin.Gen7.Scripts.Moves;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static;
using PkmnLib.Static.Species;
@@ -60,7 +59,7 @@ public class DeepCloneTests
var clonePrivateValue =
clone.GetType().GetProperty("PrivateValue", BindingFlags.NonPublic | BindingFlags.Instance)!
.GetValue(clone);
await Assert.That(clonePrivateValue).IsEqualTo(1);
await Assert.That((int)clonePrivateValue!).IsEqualTo(1);
}
[Test]
@@ -72,7 +71,7 @@ public class DeepCloneTests
await Assert.That(clone).IsNotEqualTo(obj);
var clonePrivateField =
clone.GetType().GetField("_privateField", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(clone);
await Assert.That(clonePrivateField).IsEqualTo(1);
await Assert.That((int)clonePrivateField!).IsEqualTo(1);
}
[Test]
@@ -119,8 +118,8 @@ public class DeepCloneTests
var clone = battle.DeepClone();
await Assert.That(clone).IsNotEqualTo(battle);
await Assert.That(clone.Sides[0].Pokemon[0]).IsNotEqualTo(battle.Sides[0].Pokemon[0]);
await Assert.That(clone.Sides[1].Pokemon[0]).IsNotEqualTo(battle.Sides[1].Pokemon[0]);
await Assert.That(clone.Sides[0].Pokemon[0]).IsNotEqualTo(battle.Sides[0].Pokemon[0]!);
await Assert.That(clone.Sides[1].Pokemon[0]).IsNotEqualTo(battle.Sides[1].Pokemon[0]!);
await Assert.That(clone.Sides[0].Pokemon[0]!.Species).IsEqualTo(battle.Sides[0].Pokemon[0]!.Species);
await Assert.That(clone.Sides[1].Pokemon[0]!.Species).IsEqualTo(battle.Sides[1].Pokemon[0]!.Species);
@@ -129,21 +128,21 @@ public class DeepCloneTests
var pokemon = clone.Sides[0].Pokemon[0]!;
await Assert.That(pokemon).IsNotNull();
await Assert.That(pokemon).IsNotEqualTo(battle.Sides[0].Pokemon[0]);
await Assert.That(pokemon).IsNotEqualTo(battle.Sides[0].Pokemon[0]!);
await Assert.That(pokemon.BattleData).IsNotNull();
await Assert.That(pokemon.BattleData).IsNotEqualTo(battle.Sides[0].Pokemon[0]!.BattleData);
await Assert.That(pokemon.BattleData!.Battle).IsEqualTo(clone);
await Assert.That(pokemon.BattleData).IsNotEqualTo(battle.Sides[0].Pokemon[0]!.BattleData!);
await Assert.That(pokemon.BattleData!.Battle).IsEqualTo((IBattle)clone);
await Assert.That(pokemon.BattleData!.SeenOpponents).Contains(clone.Sides[1].Pokemon[0]!);
await Assert.That(pokemon.BattleData!.SeenOpponents).DoesNotContain(battle.Sides[1].Pokemon[0]!);
await Assert.That(pokemon.StatBoost.Defense).IsEqualTo((sbyte)2);
await Assert.That(pokemon.Volatile.Get<ChargeBounceEffect>()).IsNotNull();
await Assert.That(pokemon.Volatile.Get<ChargeBounceEffect>()).IsNotEqualTo(
battle.Sides[0].Pokemon[0]!.Volatile.Get<ChargeBounceEffect>());
battle.Sides[0].Pokemon[0]!.Volatile.Get<ChargeBounceEffect>()!);
var ownerGetter =
typeof(ChargeBounceEffect).GetField("_owner", BindingFlags.NonPublic | BindingFlags.Instance)!;
var owner = ownerGetter.GetValue(pokemon.Volatile.Get<ChargeBounceEffect>()!);
await Assert.That(owner).IsEqualTo(pokemon);
await Assert.That((IPokemon)owner!).IsEqualTo(pokemon);
pokemon.Volatile.Remove<ChargeBounceEffect>();
await Assert.That(pokemon.Volatile.Get<ChargeBounceEffect>()).IsNull();