Пример #1
0
        public void XmlLyricsReader_GetLyricsLine_MultipleLinesWithDefaultTranslation()
        {
            Dictionary <double, List <string> > Tests = new Dictionary <double, List <string> >()
            {
                {
                    33.57,
                    new List <string> {
                        "夢に見た未来の凄い装置で",
                        "どんな世界も作り出せる"
                    }
                },
            };

            using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
                ILyricsReader Reader = new XmlLyricsReader(LyricsStream);

                foreach (var Expected in Tests)
                {
                    var Actual = Reader.GetLyricsLine(Expected.Key);
                    Assert.IsTrue(
                        Enumerable.SequenceEqual(Expected.Value, Actual)
                        );
                }
            }
        }
Пример #2
0
 public void XmlLyricsReader_GetDefaultTranslationID()
 {
     using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
         ILyricsReader Reader = new XmlLyricsReader(LyricsStream);
         Assert.AreEqual("jp", Reader.DefaultTranslationID);
     }
 }
Пример #3
0
        public void XmlLyricsReader_GetAllLines_WithNonDefaultTranslationID()
        {
            ILyricsLine[] Expected = new LyricsLine[] {
                new LyricsLine(22.19, 26.23, "Kanpeki na kuuki ni yotte himeru koakuma no"),
                new LyricsLine(26.24, 29.29, "Sukima o neratteku"),
                new LyricsLine(29.30, 29.51, ""),
                new LyricsLine(29.52, 33.57, "Yume ni mita mirai no sugoi souchi de"),
                new LyricsLine(33.57, 37.83, "Donna sekai mo tsukuridaseru"),
                new LyricsLine(38.37, 44.38, "Kono hoshi wa hajikeru sou da no you na")
            };

            using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
                ILyricsReader Reader = new XmlLyricsReader(LyricsStream)
                {
                    TranslationID = "jp_romaji"
                };

                Assert.IsTrue(
                    Enumerable.SequenceEqual(
                        Expected,
                        Reader.GetAllLines()
                        )
                    );
            }
        }
Пример #4
0
 public void XmlLyricsReader_LyricsMetadata_GetTitle()
 {
     using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
         ILyricsMetadata Reader = new XmlLyricsReader(LyricsStream);
         Assert.AreEqual("Arrow", Reader.Title);
     }
 }
Пример #5
0
 public void XmlLyricsReader_SetTranslationID_ToANonExistingTranslation()
 {
     using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
         ILyricsReader Reader = new XmlLyricsReader(LyricsStream);
         Reader.TranslationID = "NonExistingTranslationID";
     }
 }
Пример #6
0
 public void XmlLyricsReader_SupportsMultipleTranslations()
 {
     using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
         ILyricsReader Reader = new XmlLyricsReader(LyricsStream);
         Assert.AreEqual(true, Reader.SupportsMultipleTranslations);
     }
 }
Пример #7
0
 public void XmlLyricsReader_LyricsMetadata_GetAlbum_MissingMetadataInFile()
 {
     using (Stream LyricsStream = SampleXmlLyrics.GetLyricsFileWithMetadataMissing()) {
         ILyricsMetadata Reader = new XmlLyricsReader(LyricsStream);
         Assert.AreEqual(null, Reader.Album);
     }
 }
Пример #8
0
 public void XmlLyricsReader_LyricsMetadata_GetAlbum()
 {
     using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
         ILyricsMetadata Reader = new XmlLyricsReader(LyricsStream);
         Assert.AreEqual("Vocaloid songs", Reader.Album);
     }
 }
Пример #9
0
 public void XmlLyricsReader_LyricsMetadata_GetArtist()
 {
     using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
         ILyricsMetadata Reader = new XmlLyricsReader(LyricsStream);
         Assert.AreEqual("Namine Ritsu", Reader.Artist);
     }
 }
Пример #10
0
 public void XmlLyricsReader_SetTranslationID_ToAnExistingTranslation()
 {
     using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
         ILyricsReader Reader = new XmlLyricsReader(LyricsStream);
         Reader.TranslationID = "jp_romaji";
         Assert.AreEqual("jp_romaji", Reader.TranslationID);
     }
 }
Пример #11
0
        public void XmlLyricsReader_GetTranslations()
        {
            Dictionary <string, string> Expected = new Dictionary <string, string>()
            {
                { "jp_romaji", "Japanese (romaji)" },
                { "jp", "Japanese" }
            };

            using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
                ILyricsReader Reader = new XmlLyricsReader(LyricsStream);

                Assert.IsTrue(
                    Expected.Count == Reader.Translations.Count && !Expected.Except(Reader.Translations).Any()
                    );
            }
        }
Пример #12
0
        public void XmlLyricsReader_GetLyricsLine_UndefinedLines()
        {
            double[] TimestampsForEmptyLines =
            {
                37.84, 37.90, 38.36
            };

            using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
                ILyricsReader Reader = new XmlLyricsReader(LyricsStream);

                foreach (var Timestamp in TimestampsForEmptyLines)
                {
                    var Actual = Reader.GetLyricsLine(Timestamp);
                    Assert.AreEqual(0, Actual.Count());
                }
            }
        }
Пример #13
0
        public void XmlLyricsReader_GetLyricsLine_WithNonDefaultTranslation()
        {
            Dictionary <double, List <string> > Tests = new Dictionary <double, List <string> >()
            {
                {
                    22.19,
                    new List <string> {
                        "Kanpeki na kuuki ni yotte himeru koakuma no"
                    }
                },
                {
                    23.15,
                    new List <string> {
                        "Kanpeki na kuuki ni yotte himeru koakuma no"
                    }
                },
                {
                    26.23,
                    new List <string> {
                        "Kanpeki na kuuki ni yotte himeru koakuma no"
                    }
                }
            };

            using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
                ILyricsReader Reader = new XmlLyricsReader(LyricsStream)
                {
                    TranslationID = "jp_romaji"
                };

                foreach (var Expected in Tests)
                {
                    var Actual = Reader.GetLyricsLine(Expected.Key);
                    Assert.IsTrue(
                        Enumerable.SequenceEqual(Expected.Value, Actual)
                        );
                }
            }
        }
Пример #14
0
        public void XmlLyricsReader_GetAllLines_WithDefaultTranslationID()
        {
            ILyricsLine[] Expected = new LyricsLine[] {
                new LyricsLine(22.19, 26.23, "完璧な空気に酔って秘める小悪魔の"),
                new LyricsLine(26.24, 29.29, "隙間を狙ってく"),
                new LyricsLine(29.30, 29.51, ""),
                new LyricsLine(29.52, 33.57, "夢に見た未来の凄い装置で"),
                new LyricsLine(33.57, 37.83, "どんな世界も作り出せる"),
                new LyricsLine(38.37, 44.38, "この星は弾けるソーダのような")
            };

            using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
                ILyricsReader Reader = new XmlLyricsReader(LyricsStream);

                Assert.IsTrue(
                    Enumerable.SequenceEqual(
                        Expected,
                        Reader.GetAllLines()
                        )
                    );
            }
        }
Пример #15
0
        public void XmlLyricsReader_GetLyricsLine_WithDefaultTranslation()
        {
            Dictionary <double, List <string> > Tests = new Dictionary <double, List <string> >()
            {
                {
                    22.19,
                    new List <string> {
                        "完璧な空気に酔って秘める小悪魔の"
                    }
                },
                {
                    23.15,
                    new List <string> {
                        "完璧な空気に酔って秘める小悪魔の"
                    }
                },
                {
                    26.23,
                    new List <string> {
                        "完璧な空気に酔って秘める小悪魔の"
                    }
                }
            };

            using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
                ILyricsReader Reader = new XmlLyricsReader(LyricsStream);

                foreach (var Expected in Tests)
                {
                    var Actual = Reader.GetLyricsLine(Expected.Key);
                    Assert.IsTrue(
                        Enumerable.SequenceEqual(Expected.Value, Actual)
                        );
                }
            }
        }
Пример #16
0
        public void XmlLyricsReader_GetLyricsLine_DefinedEmptyLines()
        {
            double[] TimestampsForEmptyLines =
            {
                29.30, 29.30, 29.51
            };

            using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
                ILyricsReader Reader = new XmlLyricsReader(LyricsStream);

                foreach (var Timestamp in TimestampsForEmptyLines)
                {
                    var Actual = Reader.GetLyricsLine(Timestamp);
                    Assert.IsTrue(
                        Enumerable.SequenceEqual(
                            new List <string> {
                        String.Empty
                    },
                            Actual
                            )
                        );
                }
            }
        }
Пример #17
0
 public void XmlLyricsReader_CanLoadCorrectFile()
 {
     using (Stream LyricsStream = SampleXmlLyrics.GetCorrectXmlLyricsFile()) {
         new XmlLyricsReader(LyricsStream);
     }
 }
Пример #18
0
 public void XmlLyricsReader_CanLoadCorrectFile_WithMissingSongMetadata()
 {
     using (Stream LyricsStream = SampleXmlLyrics.GetLyricsFileWithMetadataMissing()) {
         new XmlLyricsReader(LyricsStream);
     }
 }
Пример #19
0
 public void XmlLyricsReader_CannotLoadInvalidFile_LinesTagMissing()
 {
     using (Stream LyricsStream = SampleXmlLyrics.GetLyricsFileWithLinesTagMissing()) {
         new XmlLyricsReader(LyricsStream);
     }
 }
Пример #20
0
 public void XmlLyricsReader_CannotLoadInvalidFile_NonWellFormattedXml()
 {
     using (Stream LyricsStream = SampleXmlLyrics.GetIncorrectXmlLyricsFile()) {
         new XmlLyricsReader(LyricsStream);
     }
 }