mirror of https://github.com/ppy/osu
Add test
This commit is contained in:
parent
47a93d8614
commit
9835245ea2
|
@ -68,12 +68,29 @@ public void TestDeserialiseTimeRampMod()
|
|||
Assert.That(converted.FinalRate.Value, Is.EqualTo(0.25));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDeserialiseDifficultyAdjustModWithExtendedLimits()
|
||||
{
|
||||
var apiMod = new APIMod(new TestModDifficultyAdjust
|
||||
{
|
||||
OverallDifficulty = { Value = 11 },
|
||||
ExtendedLimits = { Value = true }
|
||||
});
|
||||
|
||||
var deserialised = JsonConvert.DeserializeObject<APIMod>(JsonConvert.SerializeObject(apiMod));
|
||||
var converted = (TestModDifficultyAdjust)deserialised.ToMod(new TestRuleset());
|
||||
|
||||
Assert.That(converted.ExtendedLimits.Value, Is.True);
|
||||
Assert.That(converted.OverallDifficulty.Value, Is.EqualTo(11));
|
||||
}
|
||||
|
||||
private class TestRuleset : Ruleset
|
||||
{
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[]
|
||||
{
|
||||
new TestMod(),
|
||||
new TestModTimeRamp(),
|
||||
new TestModDifficultyAdjust()
|
||||
};
|
||||
|
||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => throw new System.NotImplementedException();
|
||||
|
@ -135,5 +152,9 @@ private class TestModTimeRamp : ModTimeRamp
|
|||
Value = true
|
||||
};
|
||||
}
|
||||
|
||||
private class TestModDifficultyAdjust : ModDifficultyAdjust
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue