public async Task ScrobblesExistingCachedTracks() { var testScrobbles = GetTestScrobbles(); // first request fails so something goes into the cache var responseMessage1 = TestHelper.CreateResponseMessage(HttpStatusCode.Forbidden, "TrackApi.TrackScrobbleBadAuthError.json"); var scrobblesToCache = testScrobbles.Take(1); var scrobbleResponse1 = await ExecuteTestInternal(scrobblesToCache, responseMessage1); Assert.AreEqual(LastResponseStatus.Cached, scrobbleResponse1.Status); var cachedTracks1 = await Scrobbler.GetCachedAsync(); TestHelper.AssertSerialiseEqual(testScrobbles.First(), cachedTracks1.FirstOrDefault()); Assert.AreEqual(1, await Scrobbler.GetCachedCountAsync()); var scrobblesToSend = testScrobbles.Skip(1).Take(1); var requestMessage2 = GenerateExpectedRequestMessage("TrackApi.TrackScrobbleTwoRequestBody.txt"); var responseMessage2 = TestHelper.CreateResponseMessage(HttpStatusCode.OK, "TrackApi.TrackScrobbleSuccess2.json"); var scrobbleResponse2 = await ExecuteTestInternal(scrobblesToSend, responseMessage2, requestMessage2); Assert.IsTrue(scrobbleResponse2.Success); Assert.AreEqual(2, scrobbleResponse2.AcceptedCount); // Should be nothing left in the cache var cachedTracks2 = await Scrobbler.GetCachedAsync(); Assert.AreEqual(0, cachedTracks2.Count()); Assert.AreEqual(0, await Scrobbler.GetCachedCountAsync()); }