mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:23:22 +08:00
Add test coverage of various ScoreInfo
mod set operations
This commit is contained in:
parent
18886f5d2e
commit
a002dacdce
@ -2,6 +2,11 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Rulesets.Mania;
|
||||
using osu.Game.Rulesets.Mania.Mods;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
@ -29,5 +34,41 @@ namespace osu.Game.Tests.NonVisual
|
||||
Assert.That(scoreCopy.Rank, Is.EqualTo(ScoreRank.B));
|
||||
Assert.That(score.Rank, Is.EqualTo(ScoreRank.X));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestModsInitiallyEmpty()
|
||||
{
|
||||
var score = new ScoreInfo();
|
||||
|
||||
Assert.That(score.Mods, Is.Empty);
|
||||
Assert.That(score.APIMods, Is.Empty);
|
||||
Assert.That(score.ModsJson, Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestModsUpdatedCorrectly()
|
||||
{
|
||||
var score = new ScoreInfo
|
||||
{
|
||||
Mods = new Mod[] { new ManiaModClassic() },
|
||||
Ruleset = new ManiaRuleset().RulesetInfo,
|
||||
};
|
||||
|
||||
Assert.That(score.Mods, Contains.Item(new ManiaModClassic()));
|
||||
Assert.That(score.APIMods, Contains.Item(new APIMod(new ManiaModClassic())));
|
||||
Assert.That(score.ModsJson, Contains.Substring("CL"));
|
||||
|
||||
score.APIMods = new[] { new APIMod(new ManiaModDoubleTime()) };
|
||||
|
||||
Assert.That(score.Mods, Contains.Item(new ManiaModDoubleTime()));
|
||||
Assert.That(score.APIMods, Contains.Item(new APIMod(new ManiaModDoubleTime())));
|
||||
Assert.That(score.ModsJson, Contains.Substring("DT"));
|
||||
|
||||
score.Mods = new Mod[] { new ManiaModClassic() };
|
||||
|
||||
Assert.That(score.Mods, Contains.Item(new ManiaModClassic()));
|
||||
Assert.That(score.APIMods, Contains.Item(new APIMod(new ManiaModClassic())));
|
||||
Assert.That(score.ModsJson, Contains.Substring("CL"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user