public async void EnsureAsyncGetTopProductsReturnsItems()
 {
     // Only test happy path, as the MusicClient tests cover the unhappy path
     IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.product_parse_tests));
     ListResponse<Product> result = await client.GetTopProductsAsync(Category.Album);
     Assert.Greater(result.Result.Count, 0, "Expected more than 0 results");
 }
Exemplo n.º 2
0
 public async Task EnsureGetTopProductsReturnsErrorForFailedCall()
 {
     IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(FakeResponse.NotFound()));
     ListResponse<Product> result = await client.GetTopProductsAsync(Category.Album);
     Assert.IsNotNull(result, "Expected a result");
     Assert.IsNotNull(result.StatusCode, "Expected a status code");
     Assert.IsTrue(result.StatusCode.HasValue, "Expected a status code");
     Assert.AreNotEqual(HttpStatusCode.OK, result.StatusCode.Value, "Expected a non-OK response");
     Assert.IsNotNull(result.Error, "Expected an error");
     Assert.AreEqual(typeof(ApiCallFailedException), result.Error.GetType(), "Expected an ApiCallFailedException");
 }
Exemplo n.º 3
0
        public async Task EnsureGetTopProductsReturnsErrorForFailedCall()
        {
            IMusicClient           client = new MusicClient("test", "gb", new MockApiRequestHandler(FakeResponse.NotFound()));
            ListResponse <Product> result = await client.GetTopProductsAsync(Category.Album);

            Assert.IsNotNull(result, "Expected a result");
            Assert.IsNotNull(result.StatusCode, "Expected a status code");
            Assert.IsTrue(result.StatusCode.HasValue, "Expected a status code");
            Assert.AreNotEqual(HttpStatusCode.OK, result.StatusCode.Value, "Expected a non-OK response");
            Assert.IsNotNull(result.Error, "Expected an error");
            Assert.AreEqual(typeof(ApiCallFailedException), result.Error.GetType(), "Expected an ApiCallFailedException");
        }
Exemplo n.º 4
0
 public async Task EnsureGetTopProductsReturnsItems()
 {
     IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.product_parse_tests));
     this.ValidateTopProductsResponse(await client.GetTopProductsAsync(Category.Album));
 }
Exemplo n.º 5
0
 public async Task EnsureGetTopProductsThrowsExceptionForUnsupportedCategory()
 {
     IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.product_parse_tests));
     await client.GetTopProductsAsync(Category.Unknown);
 }
Exemplo n.º 6
0
        public async Task EnsureGetTopProductsReturnsItems()
        {
            IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.product_parse_tests));

            this.ValidateTopProductsResponse(await client.GetTopProductsAsync(Category.Album));
        }
Exemplo n.º 7
0
 public async Task EnsureGetTopProductsThrowsExceptionForUnsupportedCategory()
 {
     IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.product_parse_tests));
     await client.GetTopProductsAsync(Category.Unknown);
 }