public void TestOnlyContainsSingers(string[] existSingers, string[] compareSingers, bool isContain) { var singers = TestCaseTagHelper.ParseSingers(compareSingers).ToList(); var lyric = new Lyric { Singers = TestCaseTagHelper.ParseSingers(existSingers)?.Select(x => x.ID).ToArray() }; Assert.AreEqual(LyricUtils.OnlyContainsSingers(lyric, singers), isContain); }
[TestCase(new[] { "[1]name:Singer1" }, "[0]name:Singer0", false, null)] // should not remove invalid singer. public void TestRemoveSinger(string[] existSingers, string removeSinger, bool isAdded, int[] actualSingers) { var singer = TestCaseTagHelper.ParseSinger(removeSinger); var lyric = new Lyric { Singers = TestCaseTagHelper.ParseSingers(existSingers)?.Select(x => x.ID).ToArray() }; try { Assert.AreEqual(LyricUtils.RemoveSinger(lyric, singer), isAdded); Assert.AreEqual(lyric.Singers, actualSingers); } catch { Assert.IsNull(actualSingers); } }