public void TestShiftingTimeTag(string shiftingTag, int shifting, string actualTag) { var timeTag = TestCaseTagHelper.ParseTimeTag(shiftingTag); var shiftingTimeTag = TimeTagUtils.ShiftingTimeTag(timeTag, shifting); var actualTimeTag = TestCaseTagHelper.ParseTimeTag(actualTag); Assert.AreEqual(shiftingTimeTag.Index, actualTimeTag.Index); Assert.AreEqual(shiftingTimeTag.Time, actualTimeTag.Time); }
[TestCase(null, null, 2, null)] // should not be null. public void GenerateTimeTag(string startTag, string endTag, int index, string result) { try { var generatedTimeTag = TimeTagsUtils.GenerateCenterTimeTag( TestCaseTagHelper.ParseTimeTag(startTag), TestCaseTagHelper.ParseTimeTag(endTag), index); var actualTimeTag = TestCaseTagHelper.ParseTimeTag(result); Assert.AreEqual(generatedTimeTag.Index, actualTimeTag.Index); Assert.AreEqual(generatedTimeTag.Time, actualTimeTag.Time); } catch { Assert.IsNull(result); } }
[TestCase(new[] { "[-1,start]:" }, new[] { "[-1,start]:" }, new[] { "[-1,start]:", "[6,start]:" })] // deal with the case with not invalid time tag position. public void TestCombineLyricTimeTag(string[] firstTimeTags, string[] secondTimeTags, string[] actualTimeTags) { var lyric1 = new Lyric { Text = "karaoke", TimeTags = TestCaseTagHelper.ParseTimeTags(firstTimeTags) }; var lyric2 = new Lyric { Text = "karaoke", TimeTags = TestCaseTagHelper.ParseTimeTags(secondTimeTags) }; var combineLyric = LyricsUtils.CombineLyric(lyric1, lyric2); var timeTags = combineLyric.TimeTags; for (int i = 0; i < timeTags.Length; i++) { var actualTimeTag = TestCaseTagHelper.ParseTimeTag(actualTimeTags[i]); Assert.AreEqual(timeTags[i].Index, actualTimeTag.Index); Assert.AreEqual(timeTags[i].Time, actualTimeTag.Time); } }
public void TestFormattedString(string tag, string format) { var timeTag = TestCaseTagHelper.ParseTimeTag(tag); Assert.AreEqual(TimeTagUtils.FormattedString(timeTag), format); }