public void GetFailWithNoData() { // Arrange ApiAController controller = new ApiAController(); controller.Request = new HttpRequestMessage(); controller.Configuration = new HttpConfiguration(); // Act var response = controller.GetByTitle("ozkan").ExecuteAsync(new System.Threading.CancellationToken()); response.Wait(); // Assert Assert.IsNotNull(response.Result); Assert.AreNotEqual(true, response.Result.IsSuccessStatusCode); Assert.AreEqual(HttpStatusCode.NotFound, response.Result.StatusCode); }
public void GetByTitle() { // Arrange ApiAController controller = new ApiAController(); controller.Request = new HttpRequestMessage(); controller.Configuration = new HttpConfiguration(); // Act var response = controller.GetByTitle("aveng").ExecuteAsync(new System.Threading.CancellationToken()); response.Wait(); // Assert Assert.IsNotNull(response.Result); Assert.AreEqual(true, response.Result.IsSuccessStatusCode); Assert.AreEqual(HttpStatusCode.OK, response.Result.StatusCode); Assert.AreNotEqual(0, response.Result.Content.ReadAsAsync <IEnumerable <MovieApiModel> >().Result.Count()); }