diff --git a/osu.Game.Tests/Online/TestSoloScoreInfoJsonSerialization.cs b/osu.Game.Tests/Online/TestSoloScoreInfoJsonSerialization.cs index 19bc96c677..509768530f 100644 --- a/osu.Game.Tests/Online/TestSoloScoreInfoJsonSerialization.cs +++ b/osu.Game.Tests/Online/TestSoloScoreInfoJsonSerialization.cs @@ -5,6 +5,7 @@ using Newtonsoft.Json; using NUnit.Framework; using osu.Game.IO.Serialization; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Scoring; using osu.Game.Tests.Resources; namespace osu.Game.Tests.Online @@ -36,5 +37,31 @@ namespace osu.Game.Tests.Online Assert.That(serialised, Contains.Substring("large_tick_hit")); Assert.That(serialised, Contains.Substring("\"rank\":\"S\"")); } + + /// + /// Ensures that the proxy implementations of by + /// do not get serialised to JSON. + /// + [Test] + public void TestScoreSerialisationSkipsInterfaceMembers() + { + var score = SoloScoreInfo.ForSubmission(TestResources.CreateTestScoreInfo()); + + string[] variants = + { + JsonConvert.SerializeObject(score), + score.Serialize() + }; + + foreach (string serialised in variants) + { + Assert.That(serialised, Does.Not.Contain("\"online_id\":")); + Assert.That(serialised, Does.Not.Contain("\"user\":")); + Assert.That(serialised, Does.Not.Contain("\"date\":")); + Assert.That(serialised, Does.Not.Contain("\"legacy_online_id\":")); + Assert.That(serialised, Does.Not.Contain("\"beatmap\":")); + Assert.That(serialised, Does.Not.Contain("\"ruleset\":")); + } + } } }