2019-12-03 04:33:42 +00: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-12-13 08:09:13 +00:00
|
|
|
|
using System;
|
2019-12-03 04:33:42 +00:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Game.Scoring;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Scores.IO
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class TestScoreEquality
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestNonMatchingByReference()
|
|
|
|
|
{
|
|
|
|
|
ScoreInfo score1 = new ScoreInfo();
|
|
|
|
|
ScoreInfo score2 = new ScoreInfo();
|
|
|
|
|
|
|
|
|
|
Assert.That(score1, Is.Not.EqualTo(score2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestMatchingByReference()
|
|
|
|
|
{
|
|
|
|
|
ScoreInfo score = new ScoreInfo();
|
|
|
|
|
|
|
|
|
|
Assert.That(score, Is.EqualTo(score));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestNonMatchingByPrimaryKey()
|
|
|
|
|
{
|
2021-12-13 08:09:13 +00:00
|
|
|
|
ScoreInfo score1 = new ScoreInfo { ID = Guid.NewGuid() };
|
|
|
|
|
ScoreInfo score2 = new ScoreInfo { ID = Guid.NewGuid() };
|
2019-12-03 04:33:42 +00:00
|
|
|
|
|
|
|
|
|
Assert.That(score1, Is.Not.EqualTo(score2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestMatchingByPrimaryKey()
|
|
|
|
|
{
|
2021-12-13 08:09:13 +00:00
|
|
|
|
Guid id = Guid.NewGuid();
|
|
|
|
|
|
|
|
|
|
ScoreInfo score1 = new ScoreInfo { ID = id };
|
|
|
|
|
ScoreInfo score2 = new ScoreInfo { ID = id };
|
2019-12-03 04:33:42 +00:00
|
|
|
|
|
|
|
|
|
Assert.That(score1, Is.EqualTo(score2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestNonMatchingByNull()
|
|
|
|
|
{
|
|
|
|
|
ScoreInfo score = new ScoreInfo();
|
|
|
|
|
|
|
|
|
|
Assert.That(score, Is.Not.EqualTo(null));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|