Esempio n. 1
0
        private void MapResToTrack(Track track, LastFmTrack LFmTrack)
        {
            if (LFmTrack.mbid != null)
                track.MBid = Guid.Parse(LFmTrack.mbid);

            //TO-DO: add mapping
        }
Esempio n. 2
0
        public void UpdateTrackDetails(Track track)
        {
            var urlProperties = new Dictionary<string, string>();
            urlProperties.Add("ARTIST_NAME", track.Tag.Artist);
            urlProperties.Add("TRACK_NAME", track.Tag.Name);

            string res = CreateAndSendTrackRequest(urlProperties, TrackGetInfoMethod);
            RootObject trackInfo = JsonConvert.DeserializeObject<RootObject>(res);
            if (trackInfo?.track != null)
            {
                MapResToTrack(track, trackInfo.track);
                track.MatchedOnLastFm = true;
            }
        }
Esempio n. 3
0
        public void GetTrackInfo_StandardScenario_GetSuccessfuly()
        {
            // Arrange
            Track track = new Track
            {
                Tag = new MediaTag
                {
                    Name = "Believe",
                    Artist = "Cher",
                },
            };
            LastFmManager manager = new LastFmManager();

            // Act
            manager.UpdateTrackDetails(track);

            // Assert
            Assert.IsTrue(track.MBid != null && track.MBid == new Guid("32ca187e-ee25-4f18-b7d0-3b6713f24635"));
        }