public void TestContainsSinger(string[] existSingers, string compareSinger, bool isContain) { var singer = TestCaseTagHelper.ParseSinger(compareSinger); var lyric = new Lyric { Singers = TestCaseTagHelper.ParseSingers(existSingers)?.Select(x => x.ID).ToArray() }; Assert.AreEqual(LyricUtils.ContainsSinger(lyric, singer), 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); } }