Пример #1
0
        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);
        }
Пример #2
0
        [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);
            }
        }
Пример #3
0
        [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);
            }
        }
Пример #4
0
        public void TestFormattedString(string tag, string format)
        {
            var timeTag = TestCaseTagHelper.ParseTimeTag(tag);

            Assert.AreEqual(TimeTagUtils.FormattedString(timeTag), format);
        }