From d3a7aa95ff3817fa5c0afd27c36c953f31d48acc Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 29 Dec 2023 21:47:36 +0900 Subject: [PATCH] Refactor the code to make the formatter happy. --- .../Beatmaps/TestElementId.cs | 17 ++++++++++++++--- .../CaretPosition/IndexCaretPositionTest.cs | 10 ++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/TestElementId.cs b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/TestElementId.cs index e79d8c312..53ff9cc22 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/TestElementId.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/TestElementId.cs @@ -84,9 +84,20 @@ public void TestCompareToOther() var elementId = new ElementId("1234567"); Assert.AreEqual(elementId.CompareTo(null), 1); - Assert.Throws(() => elementId.CompareTo(3)); // should not compare to other type - Assert.Throws(() => elementId.CompareTo("123")); // should not compare to the string also. - Assert.DoesNotThrow(() => elementId.CompareTo(new ElementId("1234567"))); + Assert.Throws(() => + { + int _ = elementId.CompareTo(3); + }); + Assert.Throws(() => + { + // 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)] diff --git a/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/Lyrics/CaretPosition/IndexCaretPositionTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/Lyrics/CaretPosition/IndexCaretPositionTest.cs index 1fd78dbcb..c5ed7693e 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/Lyrics/CaretPosition/IndexCaretPositionTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/Lyrics/CaretPosition/IndexCaretPositionTest.cs @@ -67,7 +67,10 @@ public void CompareWithDifferentLyric() var caretPosition = createBiggerCaretPosition(lyric1); var comparedCaretPosition = createSmallerCaretPosition(lyric2); - Assert.Throws(() => caretPosition.CompareTo(comparedCaretPosition)); + Assert.Throws(() => + { + int _ = caretPosition.CompareTo(comparedCaretPosition); + }); } [Test] @@ -78,7 +81,10 @@ public void CompareDifferentType() var caretPosition = createBiggerCaretPosition(lyric); var comparedCaretPosition = new FakeCaretPosition(lyric); - Assert.Throws(() => caretPosition.CompareTo(comparedCaretPosition)); + Assert.Throws(() => + { + int _ = caretPosition.CompareTo(comparedCaretPosition); + }); } private IIndexCaretPosition createSmallerCaretPosition(Lyric lyric) =>