Ejemplo n.º 1
0
        public static void LoadReleaseDetails(Release release)
        {
            XmlElement element = DiscogsAccess.LoadReleaseDetails(release);

            if (element.Name != "release")
            {
                throw new Exception("Not an release element");
            }
            if (release.Id != element.GetAttribute("id"))
            {
                throw new Exception("Invalid release id!");
            }

            if (element["images"] != null)
            {
                release.CoverArt = LoadImage(element["images"]);
            }

            List <Track> titles = new List <Track>();

            foreach (XmlNode node in element["tracklist"].ChildNodes)
            {
                if (!(node is XmlElement))
                {
                    continue;
                }
                XmlElement title = node as XmlElement;
                titles.Add(new Track(title["title"].FirstChild.Value));
            }

            release.Tracks = titles;
        }
Ejemplo n.º 2
0
        public static void TestQueryArtist_Existing()
        {
            Artist artist = DiscogsAccess.QueryArtist("La Phaze");

            UnitTest.Test(artist.Name == "La Phaze");
            UnitTest.Test(artist.Releases.Count() >= 25);

            Release release = artist.Releases.ElementAt(6);

            UnitTest.Test(release.Title == "Fin De Cycle");
            UnitTest.Test(release.Year == "2005");
            UnitTest.Test(release.Id == "958839");
            UnitTest.Test(release.Format == "CD, Album");
            UnitTest.Test(release.Label == "Because Music");

            release.LoadDetails(release);
            UnitTest.Test(release.Tracks.Count() == 14);
            UnitTest.Test(release.Tracks.ElementAt(9).Title == "Rude Boy");
        }
Ejemplo n.º 3
0
        public static void TestQueryArtist_NotExisting()
        {
            Artist artist = DiscogsAccess.QueryArtist("Nasflkjhsafasjkg");

            UnitTest.Test(Object.ReferenceEquals(artist, null));
        }
Ejemplo n.º 4
0
        public static void TestQueryAlbum_NotExisting()
        {
            Release release = DiscogsAccess.QueryAlbum("La Phaze", "ASdfkjhs");

            UnitTest.Test(Object.ReferenceEquals(release, null));
        }