2023-06-23 00:37:25 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2022-03-08 16:58:52 +08:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Game.IO.Serialization;
|
2022-07-25 18:43:19 +08:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2022-03-08 16:58:52 +08:00
|
|
|
|
using osu.Game.Tests.Resources;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Online
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Basic testing to ensure our attribute-based naming is correctly working.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[TestFixture]
|
2022-07-25 18:43:19 +08:00
|
|
|
|
public class TestSoloScoreInfoJsonSerialization
|
2022-03-08 16:58:52 +08:00
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestScoreSerialisationViaExtensionMethod()
|
|
|
|
|
{
|
2022-07-25 18:43:19 +08:00
|
|
|
|
var score = SoloScoreInfo.ForSubmission(TestResources.CreateTestScoreInfo());
|
2022-03-08 16:58:52 +08:00
|
|
|
|
|
|
|
|
|
string serialised = score.Serialize();
|
|
|
|
|
|
|
|
|
|
Assert.That(serialised, Contains.Substring("large_tick_hit"));
|
|
|
|
|
Assert.That(serialised, Contains.Substring("\"rank\": \"S\""));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestScoreSerialisationWithoutSettings()
|
|
|
|
|
{
|
2022-07-25 18:43:19 +08:00
|
|
|
|
var score = SoloScoreInfo.ForSubmission(TestResources.CreateTestScoreInfo());
|
2022-03-08 16:58:52 +08:00
|
|
|
|
|
|
|
|
|
string serialised = JsonConvert.SerializeObject(score);
|
|
|
|
|
|
|
|
|
|
Assert.That(serialised, Contains.Substring("large_tick_hit"));
|
|
|
|
|
Assert.That(serialised, Contains.Substring("\"rank\":\"S\""));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|