public async Task TestExtendedInfoAsync() { var service = new MyShowService(new Parser()); var result = await service.GetShowDescriptionAsync(113); Assert.IsNotNull(result.Item1); Assert.IsNull(result.Item2); }
public async Task TestGeneralSearchAsync() { var service = new MyShowService(new Parser()); var result = await service.SearchShowsAsync("theory"); Assert.IsNotNull(result.Item1); Assert.IsNull(result.Item2); }
public async Task TestNotFoundEpisodesAsync() { var service = new MyShowService(new Parser()); var result = await service.GetShowDescriptionAsync(-1); Assert.IsNull(result.Item1); Assert.IsTrue(result.Item2.IsSearchError); Assert.AreEqual(result.Item2.StatusCode, HttpStatusCode.NotFound); }
public async Task NotFoundTestAsync() { var service = new MyShowService(new Parser()); //сервер возращает пустой массив вместо 404, поэтому считаю, что пустой массив равен ответу 404 var searchResult = await service.SearchShowsAsync("adsfjas;dfjaskfjasdjfaksjfasjf"); Assert.AreEqual(searchResult.Item1.Count(),0); Assert.IsTrue(searchResult.Item2.IsSearchError); Assert.AreEqual(searchResult.Item2.StatusCode, HttpStatusCode.NotFound); }
public async Task TestEmptySearch() { var service = new MyShowService(new Parser()); try { await service.SearchShowsAsync(null); } catch (Exception exception) { Assert.IsInstanceOfType(exception, typeof (ArgumentException)); } try { await service.SearchShowsAsync(string.Empty); } catch (Exception exception) { Assert.IsInstanceOfType(exception, typeof (ArgumentException)); } }