1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Rewrite assertions to use nunit constraints

This commit is contained in:
Bartłomiej Dach 2023-08-22 14:37:58 +02:00
parent c9f611a713
commit ab4d47b594
No known key found for this signature in database

View File

@ -381,13 +381,13 @@ namespace osu.Game.Rulesets.Osu.Tests
private void addJudgementAssert(string name, Func<OsuHitObject?> hitObject, HitResult result)
{
AddAssert($"{name} judgement is {result}",
() => judgementResults.Single(r => r.HitObject == hitObject()).Type == result);
() => judgementResults.Single(r => r.HitObject == hitObject()).Type, () => Is.EqualTo(result));
}
private void addJudgementOffsetAssert(OsuHitObject hitObject, double offset)
{
AddAssert($"({hitObject.GetType().ReadableName()} @ {hitObject.StartTime}) judged at {offset}",
() => Precision.AlmostEquals(judgementResults.Single(r => r.HitObject == hitObject).TimeOffset, offset, 100));
() => judgementResults.Single(r => r.HitObject == hitObject).TimeOffset, () => Is.EqualTo(offset).Within(100));
}
private ScoreAccessibleReplayPlayer currentPlayer = null!;