2019-10-17 06:19:50 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2021-11-22 13:26:51 +08:00
|
|
|
using System;
|
2019-10-17 06:19:50 +08:00
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Game.Beatmaps;
|
2021-11-15 13:43:31 +08:00
|
|
|
using osu.Game.Extensions;
|
2019-10-17 06:19:50 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Tests.NonVisual
|
|
|
|
{
|
|
|
|
[TestFixture]
|
|
|
|
public class BeatmapSetInfoEqualityTest
|
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void TestOnlineWithOnline()
|
|
|
|
{
|
2021-11-12 16:50:31 +08:00
|
|
|
var ourInfo = new BeatmapSetInfo { OnlineID = 123 };
|
|
|
|
var otherInfo = new BeatmapSetInfo { OnlineID = 123 };
|
2019-10-17 06:19:50 +08:00
|
|
|
|
2021-11-15 13:43:31 +08:00
|
|
|
Assert.AreNotEqual(ourInfo, otherInfo);
|
|
|
|
Assert.IsTrue(ourInfo.MatchesOnlineID(otherInfo));
|
2019-10-17 06:19:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestDatabasedWithDatabased()
|
|
|
|
{
|
2021-11-22 13:26:51 +08:00
|
|
|
var guid = Guid.NewGuid();
|
|
|
|
|
|
|
|
var ourInfo = new BeatmapSetInfo { ID = guid };
|
|
|
|
var otherInfo = new BeatmapSetInfo { ID = guid };
|
2019-10-17 06:19:50 +08:00
|
|
|
|
|
|
|
Assert.AreEqual(ourInfo, otherInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestDatabasedWithOnline()
|
|
|
|
{
|
2021-11-22 13:26:51 +08:00
|
|
|
var ourInfo = new BeatmapSetInfo { ID = Guid.NewGuid(), OnlineID = 12 };
|
2021-11-12 16:50:31 +08:00
|
|
|
var otherInfo = new BeatmapSetInfo { OnlineID = 12 };
|
2019-10-17 06:19:50 +08:00
|
|
|
|
2021-11-15 13:43:31 +08:00
|
|
|
Assert.AreNotEqual(ourInfo, otherInfo);
|
|
|
|
Assert.IsTrue(ourInfo.MatchesOnlineID(otherInfo));
|
2019-10-17 06:19:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestCheckNullID()
|
|
|
|
{
|
2021-11-01 14:42:12 +08:00
|
|
|
var ourInfo = new BeatmapSetInfo { Hash = "1" };
|
|
|
|
var otherInfo = new BeatmapSetInfo { Hash = "2" };
|
2019-10-17 06:19:50 +08:00
|
|
|
|
|
|
|
Assert.AreNotEqual(ourInfo, otherInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|