public void Can_Read_Sample()
 {
     TvDbLanguageXmlReader reader = new TvDbLanguageXmlReader();
     string xml = GetSampleXml();
     var languages = reader.Read(xml);
     Assert.NotNull(languages);
     Assert.True(languages.Any());
 }
        public void Id_Property_Gets_Set_Correctly()
        {
            TvDbLanguageXmlReader reader = new TvDbLanguageXmlReader();
            string xml = GetSampleXml();
            var languages = reader.Read(xml);

            var dansk = languages.First();
            string expected = "10";
            string actual = dansk.Id;
            Assert.Equal(expected, actual);

            var english = languages.Last();
            expected = "9";
            actual = english.Id;
            Assert.Equal(expected, actual);
        }
Example #3
0
 /// <summary>
 /// Gets the list of languages from TvDb.
 /// </summary>
 /// <returns>a collection of TvDbLanguage objects.</returns>
 public virtual IEnumerable<TvDbLanguage> GetLanguages()
 {
     if (languages == null)
     {
         lock (languagesLock)
         {
             if (languages == null)
             {
                 string languageXml = GetLanguagesXml();
                 TvDbLanguageXmlReader xmlReader = new TvDbLanguageXmlReader();
                 languages = xmlReader.Read(languageXml);
             }
         }
     }
     return languages;
 }