diff --git a/LrcParser.Tests/Extension/EnumerableExtensionsTest.cs b/LrcParser.Tests/Extension/EnumerableExtensionsTest.cs
index c9e97c4..43a4a39 100644
--- a/LrcParser.Tests/Extension/EnumerableExtensionsTest.cs
+++ b/LrcParser.Tests/Extension/EnumerableExtensionsTest.cs
@@ -15,7 +15,7 @@ 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" })]
@@ -23,6 +23,6 @@ public void TestGroupByContinuous(int[] values, int[] expected)
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));
}
}
diff --git a/LrcParser.Tests/LrcParser.Tests.csproj b/LrcParser.Tests/LrcParser.Tests.csproj
index e1e37e4..0cd8d02 100644
--- a/LrcParser.Tests/LrcParser.Tests.csproj
+++ b/LrcParser.Tests/LrcParser.Tests.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/LrcParser.Tests/Model/TextIndexTest.cs b/LrcParser.Tests/Model/TextIndexTest.cs
index 80ec53a..70a4c5f 100644
--- a/LrcParser.Tests/Model/TextIndexTest.cs
+++ b/LrcParser.Tests/Model/TextIndexTest.cs
@@ -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")]
@@ -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)]
@@ -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)]
@@ -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)]
@@ -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)]
@@ -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));
}
}
diff --git a/LrcParser.Tests/Parser/BaseLyricParserTest.cs b/LrcParser.Tests/Parser/BaseLyricParserTest.cs
index 17af525..51a6a1a 100644
--- a/LrcParser.Tests/Parser/BaseLyricParserTest.cs
+++ b/LrcParser.Tests/Parser/BaseLyricParserTest.cs
@@ -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;
@@ -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));
}
}
diff --git a/LrcParser.Tests/Parser/Lrc/Lines/LrcLyricParserTest.cs b/LrcParser.Tests/Parser/Lrc/Lines/LrcLyricParserTest.cs
index ce74d18..517f38f 100644
--- a/LrcParser.Tests/Parser/Lrc/Lines/LrcLyricParserTest.cs
+++ b/LrcParser.Tests/Parser/Lrc/Lines/LrcLyricParserTest.cs
@@ -19,7 +19,7 @@ public class LrcLyricParserTest : BaseSingleLineParserTest x.Text));
+ Assert.That(actual.Lyrics.Select(x => x.Text), Is.EqualTo(expected));
}
public class TestLyricParser : LyricParser
diff --git a/LrcParser.Tests/Utils/TextIndexUtilsTest.cs b/LrcParser.Tests/Utils/TextIndexUtilsTest.cs
index b5578ad..26cb43f 100644
--- a/LrcParser.Tests/Utils/TextIndexUtilsTest.cs
+++ b/LrcParser.Tests/Utils/TextIndexUtilsTest.cs
@@ -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)]
@@ -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)]
@@ -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));
}
}
diff --git a/LrcParser.Tests/Utils/TypeUtilsTest.cs b/LrcParser.Tests/Utils/TypeUtilsTest.cs
index 583d035..59eeae9 100644
--- a/LrcParser.Tests/Utils/TypeUtilsTest.cs
+++ b/LrcParser.Tests/Utils/TypeUtilsTest.cs
@@ -13,31 +13,31 @@ public class TypeUtilsTest
public void TestChangeTypeToSameType()
{
// test string
- Assert.AreEqual("123", TypeUtils.ChangeType("123"));
+ Assert.That(TypeUtils.ChangeType("123"), Is.EqualTo("123"));
// test number
- Assert.AreEqual(456, TypeUtils.ChangeType(456));
+ Assert.That(TypeUtils.ChangeType(456), Is.EqualTo(456));
// test another number
- Assert.AreEqual(789f, TypeUtils.ChangeType(789f));
+ Assert.That(TypeUtils.ChangeType(789f), Is.EqualTo(789f));
// test class, should use same instance.
var testClass = new TestClass();
- Assert.AreEqual(testClass, TypeUtils.ChangeType(testClass));
+ Assert.That(TypeUtils.ChangeType(testClass), Is.EqualTo(testClass));
}
[Test]
public void TestChangeTypeToDifferentType()
{
// test convert to number
- Assert.AreEqual(Convert.ToDouble(123), TypeUtils.ChangeType(123));
+ Assert.That(TypeUtils.ChangeType(123), Is.EqualTo(Convert.ToDouble(123)));
// test convert to string
- Assert.AreEqual(Convert.ToString(123), TypeUtils.ChangeType(123));
+ Assert.That(TypeUtils.ChangeType(123), Is.EqualTo(Convert.ToString(123)));
// test convert to nullable
- Assert.AreEqual(123, TypeUtils.ChangeType(123d));
- Assert.AreEqual(default(double?), TypeUtils.ChangeType(null));
+ Assert.That(TypeUtils.ChangeType(123d), Is.EqualTo(123));
+ Assert.That(TypeUtils.ChangeType(null), Is.EqualTo(default(double?)));
}
private class TestClass