1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Remove OnlineID comparison from ScoreInfo.Equals

This matches the implementation we have for `BeatmapInfo` and
`BeatmapSetInfo`. All comparisons of `OnlineID` should be done directly
using them (ie. how it's done in `ScoreModelDownloader`).
This commit is contained in:
Dean Herbert 2021-12-10 18:11:52 +09:00
parent c6d0d6451d
commit 5f6e887be7
2 changed files with 3 additions and 27 deletions

View File

@ -44,24 +44,6 @@ namespace osu.Game.Tests.Scores.IO
Assert.That(score1, Is.EqualTo(score2));
}
[Test]
public void TestNonMatchingByHash()
{
ScoreInfo score1 = new ScoreInfo { Hash = "a" };
ScoreInfo score2 = new ScoreInfo { Hash = "b" };
Assert.That(score1, Is.Not.EqualTo(score2));
}
[Test]
public void TestMatchingByHash()
{
ScoreInfo score1 = new ScoreInfo { Hash = "a" };
ScoreInfo score2 = new ScoreInfo { Hash = "a" };
Assert.That(score1, Is.EqualTo(score2));
}
[Test]
public void TestNonMatchingByNull()
{

View File

@ -232,19 +232,13 @@ namespace osu.Game.Scoring
public bool Equals(ScoreInfo other)
{
if (other == null)
return false;
if (ReferenceEquals(this, other)) return true;
if (other == null) return false;
if (ID != 0 && other.ID != 0)
return ID == other.ID;
if (OnlineID > 0)
return OnlineID == other.OnlineID;
if (!string.IsNullOrEmpty(Hash) && !string.IsNullOrEmpty(other.Hash))
return Hash == other.Hash;
return ReferenceEquals(this, other);
return false;
}
#region Implementation of IHasOnlineID