예제 #1
0
        public async Task ScrobblesMultiple()
        {
            var scrobbles = GenerateScrobbles(4);

            var countingHandler = new CountingHttpClientHandler();
            var httpClient = new HttpClient(countingHandler);
            var scrobbler = new Scrobbler(Lastfm.Auth, httpClient)
            {
                MaxBatchSize = 2
            };
            var response = await scrobbler.ScrobbleAsync(scrobbles);
            
            Assert.AreEqual(2, countingHandler.Count);
            Assert.AreEqual(LastResponseStatus.Successful, response.Status);
            Assert.IsTrue(response.Success);
        }
예제 #2
0
 public async void ScrobbleTrack(string artist, string album, string track)
 {
     var trackApi = new TrackApi(_auth);
     var scrobble = new Scrobble(artist, album, track, DateTimeOffset.Now);
     IScrobbler _scrobbler;
     _scrobbler = new Scrobbler(_auth);
     var response = await _scrobbler.ScrobbleAsync(scrobble);
     if (response.Success)
     {
         Debug.WriteLine("Scrobble success!");
     }
     else
     {
         Debug.WriteLine("Scrobble failed!");
     }
 }
 /// <summary>
 /// Triggers when the <see cref="UserViewModel.ActiveUser"/> changes.
 /// </summary>
 /// <param name="sender">Ignored.</param>
 /// <param name="e">Ignored.</param>
 private void UserViewModel_ActiveUserChanged(object sender, EventArgs e)
 {
   NotifyOfPropertyChange(() => StatusBarUsername);
   Scrobbler = new Scrobbler(Client.Auth);
 }