Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump NUnit from 3.13.3 to 4.0.1 #59

Merged
merged 1 commit into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions LrcParser.Tests/Extension/EnumerableExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public class EnumerableExtensionsTest
public void TestGroupByContinuous(int[] values, int[] expected)
{
var groups = values.GroupByContinuous(x => x);
Assert.AreEqual(expected, groups.Select(x => x.Key));
Assert.That(groups.Select(x => x.Key), Is.EqualTo(expected));
}

[TestCase(new[] { "A", "B", "C" }, new[] { "A", "B", "C" })]
[TestCase(new[] { "A", "A", "A" }, new[] { "A" })]
public void TestGroupByContinuous(string[] values, string[] expected)
{
var groups = values.GroupByContinuous(x => x);
Assert.AreEqual(expected, groups.Select(x => x.Key));
Assert.That(groups.Select(x => x.Key), Is.EqualTo(expected));
}
}
2 changes: 1 addition & 1 deletion LrcParser.Tests/LrcParser.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

Expand Down
12 changes: 6 additions & 6 deletions LrcParser.Tests/Model/TextIndexTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class TextIndexTest
[TestCase("-1,start")]
public void TestOperatorEqual(string textIndex1)
{
Assert.AreEqual(TestCaseTextIndexHelper.ParseTextIndex(textIndex1), TestCaseTextIndexHelper.ParseTextIndex(textIndex1));
Assert.That(TestCaseTextIndexHelper.ParseTextIndex(textIndex1), Is.EqualTo(TestCaseTextIndexHelper.ParseTextIndex(textIndex1)));
}

[TestCase("-1,start", "1,start")]
Expand All @@ -25,7 +25,7 @@ public void TestOperatorEqual(string textIndex1)
[TestCase("-2,end", "-2,start")]
public void TestOperatorNotEqual(string textIndex1, string textIndex2)
{
Assert.AreNotEqual(TestCaseTextIndexHelper.ParseTextIndex(textIndex1), TestCaseTextIndexHelper.ParseTextIndex(textIndex2));
Assert.That(TestCaseTextIndexHelper.ParseTextIndex(textIndex1), Is.Not.EqualTo(TestCaseTextIndexHelper.ParseTextIndex(textIndex2)));
}

[TestCase("1,start", "0,start", true)]
Expand All @@ -34,7 +34,7 @@ public void TestOperatorNotEqual(string textIndex1, string textIndex2)
[TestCase("1,start", "1,end", false)]
public void TestOperatorGreater(string textIndex1, string textIndex2, bool match)
{
Assert.AreEqual(TestCaseTextIndexHelper.ParseTextIndex(textIndex1) > TestCaseTextIndexHelper.ParseTextIndex(textIndex2), match);
Assert.That(TestCaseTextIndexHelper.ParseTextIndex(textIndex1) > TestCaseTextIndexHelper.ParseTextIndex(textIndex2), Is.EqualTo(match));
}

[TestCase("1,start", "0,start", true)]
Expand All @@ -43,7 +43,7 @@ public void TestOperatorGreater(string textIndex1, string textIndex2, bool match
[TestCase("1,start", "1,end", false)]
public void TestOperatorGreaterOrEqual(string textIndex1, string textIndex2, bool match)
{
Assert.AreEqual(TestCaseTextIndexHelper.ParseTextIndex(textIndex1) >= TestCaseTextIndexHelper.ParseTextIndex(textIndex2), match);
Assert.That(TestCaseTextIndexHelper.ParseTextIndex(textIndex1) >= TestCaseTextIndexHelper.ParseTextIndex(textIndex2), Is.EqualTo(match));
}

[TestCase("-1,start", "0,start", true)]
Expand All @@ -52,7 +52,7 @@ public void TestOperatorGreaterOrEqual(string textIndex1, string textIndex2, boo
[TestCase("-1,start", "-2,end", false)]
public void TestOperatorLess(string textIndex1, string textIndex2, bool match)
{
Assert.AreEqual(TestCaseTextIndexHelper.ParseTextIndex(textIndex1) < TestCaseTextIndexHelper.ParseTextIndex(textIndex2), match);
Assert.That(TestCaseTextIndexHelper.ParseTextIndex(textIndex1) < TestCaseTextIndexHelper.ParseTextIndex(textIndex2), Is.EqualTo(match));
}

[TestCase("-1,start", "0,start", true)]
Expand All @@ -61,6 +61,6 @@ public void TestOperatorLess(string textIndex1, string textIndex2, bool match)
[TestCase("-1,start", "-2,end", false)]
public void TestOperatorLessOrEqual(string textIndex1, string textIndex2, bool match)
{
Assert.AreEqual(TestCaseTextIndexHelper.ParseTextIndex(textIndex1) <= TestCaseTextIndexHelper.ParseTextIndex(textIndex2), match);
Assert.That(TestCaseTextIndexHelper.ParseTextIndex(textIndex1) <= TestCaseTextIndexHelper.ParseTextIndex(textIndex2), Is.EqualTo(match));
}
}
12 changes: 6 additions & 6 deletions LrcParser.Tests/Parser/BaseLyricParserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ protected static void AreEqual(Song expected, Song actual)

private static void areEqual(Lyric expected, Lyric actual)
{
Assert.AreEqual(expected.Text, actual.Text);
Assert.AreEqual(expected.TimeTags, actual.TimeTags);
Assert.That(actual.Text, Is.EqualTo(expected.Text));
Assert.That(actual.TimeTags, Is.EqualTo(expected.TimeTags));

var expectedRubies = expected.RubyTags;
var actualRubies = actual.RubyTags;
Expand All @@ -43,9 +43,9 @@ private static void areEqual(Lyric expected, Lyric actual)

private static void areEqual(RubyTag expected, RubyTag actual)
{
Assert.AreEqual(expected.Text, actual.Text);
Assert.AreEqual(expected.TimeTags, actual.TimeTags);
Assert.AreEqual(expected.StartCharIndex, actual.StartCharIndex);
Assert.AreEqual(expected.EndCharIndex, actual.EndCharIndex);
Assert.That(actual.Text, Is.EqualTo(expected.Text));
Assert.That(actual.TimeTags, Is.EqualTo(expected.TimeTags));
Assert.That(actual.StartCharIndex, Is.EqualTo(expected.StartCharIndex));
Assert.That(actual.EndCharIndex, Is.EqualTo(expected.EndCharIndex));
}
}
8 changes: 4 additions & 4 deletions LrcParser.Tests/Parser/Lrc/Lines/LrcLyricParserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class LrcLyricParserTest : BaseSingleLineParserTest<LrcLyricParser, LrcLy
public void TestCanDecode(string text, bool expected)
{
var actual = CanDecode(text);
Assert.AreEqual(expected, actual);
Assert.That(actual, Is.EqualTo(expected));
}

[TestCase("[00:17:97]帰[00:18:37]り[00:18:55]道[00:18:94]は[00:19:22]", "帰り道は", new[] { "[0,start]:17970", "[1,start]:18370", "[2,start]:18550", "[3,start]:18940", "[3,end]:19220" })]
Expand All @@ -37,8 +37,8 @@ public void TestDecode(string lyric, string text, string[] timeTags)
};
var actual = Decode(lyric);

Assert.AreEqual(expected.Text, actual.Text);
Assert.AreEqual(expected.TimeTags, actual.TimeTags);
Assert.That(actual.Text, Is.EqualTo(expected.Text));
Assert.That(actual.TimeTags, Is.EqualTo(expected.TimeTags));
}

[TestCase("帰り道は", new[] { "[0,start]:17970", "[1,start]:18370", "[2,start]:18550", "[3,start]:18940", "[3,end]:19220" }, "[00:17.97]帰[00:18.37]り[00:18.55]道[00:18.94]は[00:19.22]")]
Expand All @@ -55,6 +55,6 @@ public void TestEncode(string text, string[] timeTags, string expected)
};
var actual = Encode(lyric);

Assert.AreEqual(expected, actual);
Assert.That(actual, Is.EqualTo(expected));
}
}
14 changes: 7 additions & 7 deletions LrcParser.Tests/Parser/Lrc/Lines/LrcRubyParserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class LrcRubyParserTest : BaseSingleLineParserTest<LrcRubyParser, LrcRuby
public void TestCanDecode(string text, bool expected)
{
var actual = CanDecode(text);
Assert.AreEqual(expected, actual);
Assert.That(actual, Is.EqualTo(expected));
}

[TestCase("@Ruby1=帰,かえ,[00:53:19],[01:24:77]", "帰", "かえ", new string[] { }, 53190, 84770)]
Expand All @@ -39,11 +39,11 @@ public void TestDecode(string rubyTag, string parent, string ruby, string[] time
};
var actual = Decode(rubyTag);

Assert.AreEqual(expected.Ruby, actual.Ruby);
Assert.AreEqual(expected.Parent, actual.Parent);
Assert.AreEqual(expected.TimeTags, actual.TimeTags);
Assert.AreEqual(expected.StartTime, actual.StartTime);
Assert.AreEqual(expected.EndTime, actual.EndTime);
Assert.That(actual.Ruby, Is.EqualTo(expected.Ruby));
Assert.That(actual.Parent, Is.EqualTo(expected.Parent));
Assert.That(actual.TimeTags, Is.EqualTo(expected.TimeTags));
Assert.That(actual.StartTime, Is.EqualTo(expected.StartTime));
Assert.That(actual.EndTime, Is.EqualTo(expected.EndTime));
}

[TestCase("帰", "かえ", new string[] { }, 53190, 84770, "@Ruby1=帰,かえ,[00:53.19],[01:24.77]")]
Expand All @@ -63,6 +63,6 @@ public void TestEncode(string parent, string ruby, string[] timeTags, int? start
};
var actual = Encode(rubyTag);

Assert.AreEqual(expected, actual);
Assert.That(actual, Is.EqualTo(expected));
}
}
2 changes: 1 addition & 1 deletion LrcParser.Tests/Parser/Lrc/LrcParserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,6 @@ private void checkEncode(Song song, string[] lrcTexts)
{
var expected = string.Join('\n', lrcTexts);
var actual = Encode(song);
Assert.AreEqual(expected, actual);
Assert.That(actual, Is.EqualTo(expected));
}
}
6 changes: 3 additions & 3 deletions LrcParser.Tests/Parser/Lrc/Utils/LrcTimedTextUtilsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public void TestDecode(string text, string expectedText, string[] expectedTimeTa
{
var (actualText, actualTimeTags) = LrcTimedTextUtils.TimedTextToObject(text);

Assert.AreEqual(expectedText, actualText);
Assert.AreEqual(TestCaseTagHelper.ParseTimeTags(expectedTimeTags), actualTimeTags);
Assert.That(actualText, Is.EqualTo(expectedText));
Assert.That(actualTimeTags, Is.EqualTo(TestCaseTagHelper.ParseTimeTags(expectedTimeTags)));
}

[TestCase("帰り道は", new[] { "[0,start]:17970", "[1,start]:18370", "[2,start]:18550", "[3,start]:18940", "[3,end]:19220" }, "[00:17.97]帰[00:18.37]り[00:18.55]道[00:18.94]は[00:19.22]")]
Expand All @@ -38,6 +38,6 @@ public void TestEncode(string text, string[] timeTags, string expected)
{
var actual = LrcTimedTextUtils.ToTimedText(text, TestCaseTagHelper.ParseTimeTags(timeTags));

Assert.AreEqual(expected, actual);
Assert.That(actual, Is.EqualTo(expected));
}
}
4 changes: 2 additions & 2 deletions LrcParser.Tests/Parser/Lrc/Utils/TimeTagUtilsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public void TestTimeTagToMillionSecond(string timeTag, int millionSecond)
{
var actual = TimeTagUtils.TimeTagToMillionSecond(timeTag);

Assert.AreEqual(millionSecond, actual);
Assert.That(actual, Is.EqualTo(millionSecond));
}

[TestCase(1000, "[00:01.00]")]
public void TestTimeTagToMillionSecond(int millionSecond, string timeTag)
{
var actual = TimeTagUtils.MillionSecondToTimeTag(millionSecond);

Assert.AreEqual(timeTag, actual);
Assert.That(actual, Is.EqualTo(timeTag));
}
}
6 changes: 3 additions & 3 deletions LrcParser.Tests/Parser/LyricParserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class LyricParserTest : BaseLyricParserTest<LyricParserTest.TestLyricPars
public void TestDecodeWithEmptyFile(string lrcText)
{
var actual = Decode(lrcText);
Assert.IsEmpty(actual.Lyrics);
Assert.That(actual.Lyrics, Is.Empty);
}

[TestCase("karaoke\nカラオケ", new[] { "karaoke", "カラオケ" })]
Expand All @@ -30,10 +30,10 @@ public void TestDecodeWithEmptyFile(string lrcText)
[TestCase("karaoke\nカラオケ\n", new[] { "karaoke", "カラオケ" })]
[TestCase("karaoke\rカラオケ\r", new[] { "karaoke", "カラオケ" })]
[TestCase("karaoke\r\nカラオケ\r\n", new[] { "karaoke", "カラオケ" })]
public void TestChangeNewLine(string lrcText, string[] lyrics)
public void TestChangeNewLine(string lrcText, string[] expected)
{
var actual = Decode(lrcText);
Assert.AreEqual(lyrics, actual.Lyrics.Select(x => x.Text));
Assert.That(actual.Lyrics.Select(x => x.Text), Is.EqualTo(expected));
}

public class TestLyricParser : LyricParser
Expand Down
6 changes: 3 additions & 3 deletions LrcParser.Tests/Utils/TextIndexUtilsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void TestToCharIndex(int index, IndexState state, int expected)
var textIndex = new TextIndex(index, state);

int actual = TextIndexUtils.ToCharIndex(textIndex);
Assert.AreEqual(expected, actual);
Assert.That(actual, Is.EqualTo(expected));
}

[TestCase(0, IndexState.Start, 0)]
Expand All @@ -30,7 +30,7 @@ public void TestToGapIndex(int index, IndexState state, int expected)
var textIndex = new TextIndex(index, state);

int actual = TextIndexUtils.ToGapIndex(textIndex);
Assert.AreEqual(expected, actual);
Assert.That(actual, Is.EqualTo(expected));
}

[TestCase(IndexState.Start, 1, -1, 1)]
Expand All @@ -42,6 +42,6 @@ public void TestGetValueByState(IndexState state, object startValue, object endV
var textIndex = new TextIndex(0, state);

object actual = TextIndexUtils.GetValueByState(textIndex, startValue, endValue);
Assert.AreEqual(expected, actual);
Assert.That(actual, Is.EqualTo(expected));
}
}
16 changes: 8 additions & 8 deletions LrcParser.Tests/Utils/TypeUtilsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ public class TypeUtilsTest
public void TestChangeTypeToSameType()
{
// test string
Assert.AreEqual("123", TypeUtils.ChangeType<string>("123"));
Assert.That(TypeUtils.ChangeType<string>("123"), Is.EqualTo("123"));

// test number
Assert.AreEqual(456, TypeUtils.ChangeType<int>(456));
Assert.That(TypeUtils.ChangeType<int>(456), Is.EqualTo(456));

// test another number
Assert.AreEqual(789f, TypeUtils.ChangeType<float>(789f));
Assert.That(TypeUtils.ChangeType<float>(789f), Is.EqualTo(789f));

// test class, should use same instance.
var testClass = new TestClass();
Assert.AreEqual(testClass, TypeUtils.ChangeType<TestClass>(testClass));
Assert.That(TypeUtils.ChangeType<TestClass>(testClass), Is.EqualTo(testClass));
}

[Test]
public void TestChangeTypeToDifferentType()
{
// test convert to number
Assert.AreEqual(Convert.ToDouble(123), TypeUtils.ChangeType<double>(123));
Assert.That(TypeUtils.ChangeType<double>(123), Is.EqualTo(Convert.ToDouble(123)));

// test convert to string
Assert.AreEqual(Convert.ToString(123), TypeUtils.ChangeType<string>(123));
Assert.That(TypeUtils.ChangeType<string>(123), Is.EqualTo(Convert.ToString(123)));

// test convert to nullable
Assert.AreEqual(123, TypeUtils.ChangeType<double?>(123d));
Assert.AreEqual(default(double?), TypeUtils.ChangeType<double?>(null));
Assert.That(TypeUtils.ChangeType<double?>(123d), Is.EqualTo(123));
Assert.That(TypeUtils.ChangeType<double?>(null), Is.EqualTo(default(double?)));
}

private class TestClass
Expand Down
Loading