public async Task EnsureRequestIdComesBackInResponse()
        {
            IMusicClient          client    = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.search_suggestions));
            var                   requestId = Guid.NewGuid();
            ListResponse <string> result    = await client.GetSearchSuggestionsAsync("green", requestId : requestId);

            Assert.IsNotNull(result, "Expected a result");
            Assert.AreEqual(requestId, result.RequestId);
        }
        public async Task EnsureRequestIdComesBackInResponse()
        {
            IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.search_suggestions));
            var requestId = Guid.NewGuid();
            ListResponse<string> result = await client.GetSearchSuggestionsAsync("green", requestId: requestId);

            Assert.IsNotNull(result, "Expected a result");
            Assert.AreEqual(requestId, result.RequestId);
        }
 public async Task EnsureGetSearchSuggestionsReturnsErrorForFailedCall()
 {
     IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.search_suggestions_noresults));
     ListResponse<string> result = await client.GetSearchSuggestionsAsync("muse");
     Assert.IsNotNull(result, "Expected a result");
     Assert.IsNotNull(result.StatusCode, "Expected a status code");
     Assert.IsTrue(result.StatusCode.HasValue, "Expected a status code");
     Assert.AreEqual(HttpStatusCode.OK, result.StatusCode.Value, "Expected a 200 response");
     Assert.IsNotNull(result.Result, "Expected a list of results");
     Assert.IsNull(result.Error, "Expected no error");
     Assert.AreEqual(result.Result.Count, 0, "Expected 0 results");
 }
        public async Task EnsureGetSearchSuggestionsReturnsErrorForFailedCall()
        {
            IMusicClient          client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.search_suggestions_noresults));
            ListResponse <string> result = await client.GetSearchSuggestionsAsync("muse");

            Assert.IsNotNull(result, "Expected a result");
            Assert.IsNotNull(result.StatusCode, "Expected a status code");
            Assert.IsTrue(result.StatusCode.HasValue, "Expected a status code");
            Assert.AreEqual(HttpStatusCode.OK, result.StatusCode.Value, "Expected a 200 response");
            Assert.IsNotNull(result.Result, "Expected a list of results");
            Assert.IsNull(result.Error, "Expected no error");
            Assert.AreEqual(result.Result.Count, 0, "Expected 0 results");
        }
 public async void EnsureAsyncGetSearchSuggestionsReturnsItems()
 {
     // Only test happy path, as the MusicClient tests cover the unhappy path
     IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.search_suggestions));
     ListResponse<string> result = await client.GetSearchSuggestionsAsync("test");
     Assert.Greater(result.Result.Count, 0, "Expected more than 0 results");
 }
 public async Task EnsureGetSearchSuggestionsThrowsExceptionForNullSearchTerm()
 {
     IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.search_suggestions));
     await client.GetSearchSuggestionsAsync(null);
 }
 public void EnsureGetSearchSuggestionsThrowsExceptionForNullSearchTerm()
 {
     IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.search_suggestions));
     client.GetSearchSuggestionsAsync(null).Wait();
 }