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 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)); } }