mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Add test
This commit is contained in:
@ -68,12 +68,29 @@ namespace osu.Game.Tests.Online
|
|||||||
Assert.That(converted.FinalRate.Value, Is.EqualTo(0.25));
|
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
|
private class TestRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[]
|
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[]
|
||||||
{
|
{
|
||||||
new TestMod(),
|
new TestMod(),
|
||||||
new TestModTimeRamp(),
|
new TestModTimeRamp(),
|
||||||
|
new TestModDifficultyAdjust()
|
||||||
};
|
};
|
||||||
|
|
||||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => throw new System.NotImplementedException();
|
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => throw new System.NotImplementedException();
|
||||||
@ -135,5 +152,9 @@ namespace osu.Game.Tests.Online
|
|||||||
Value = true
|
Value = true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TestModDifficultyAdjust : ModDifficultyAdjust
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user