Skip to content

Commit

Permalink
Refactor the code to make the formatter happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Dec 29, 2023
1 parent 0084f0e commit d3a7aa9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
17 changes: 14 additions & 3 deletions osu.Game.Rulesets.Karaoke.Tests/Beatmaps/TestElementId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,20 @@ public void TestCompareToOther()
var elementId = new ElementId("1234567");

Assert.AreEqual(elementId.CompareTo(null), 1);
Assert.Throws<ArgumentException>(() => elementId.CompareTo(3)); // should not compare to other type
Assert.Throws<ArgumentException>(() => elementId.CompareTo("123")); // should not compare to the string also.
Assert.DoesNotThrow(() => elementId.CompareTo(new ElementId("1234567")));
Assert.Throws<ArgumentException>(() =>
{
int _ = elementId.CompareTo(3);
});
Assert.Throws<ArgumentException>(() =>
{
// should not compare to other type
int _ = elementId.CompareTo("123");
});
Assert.DoesNotThrow(() =>
{
// should not compare to the string also.
int _ = elementId.CompareTo(new ElementId("1234567"));
});
}

[TestCase("1234567", "1234567", true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ public void CompareWithDifferentLyric()
var caretPosition = createBiggerCaretPosition(lyric1);
var comparedCaretPosition = createSmallerCaretPosition(lyric2);

Assert.Throws<InvalidOperationException>(() => caretPosition.CompareTo(comparedCaretPosition));
Assert.Throws<InvalidOperationException>(() =>
{
int _ = caretPosition.CompareTo(comparedCaretPosition);
});
}

[Test]
Expand All @@ -78,7 +81,10 @@ public void CompareDifferentType()
var caretPosition = createBiggerCaretPosition(lyric);
var comparedCaretPosition = new FakeCaretPosition(lyric);

Assert.Throws<InvalidOperationException>(() => caretPosition.CompareTo(comparedCaretPosition));
Assert.Throws<InvalidOperationException>(() =>
{
int _ = caretPosition.CompareTo(comparedCaretPosition);
});
}

private IIndexCaretPosition createSmallerCaretPosition(Lyric lyric) =>
Expand Down

0 comments on commit d3a7aa9

Please sign in to comment.