public async Task Get20ByVideoId_ShouldReturnCorrectData() { var page = 0; var result = await commentService.Get10ByVideoIdAsync(page, null); var invalid = await commentService.Get10ByVideoIdAsync(page, "invalid"); CollectionAssert.IsEmpty(result); CollectionAssert.IsEmpty(invalid); var expected = 2; var videos = await commentService.Get10ByVideoIdAsync(page, "v1"); var actual = videos.Count; Assert.AreEqual(expected, actual); }
public async Task <IActionResult> Get10(int page, string id) { if (id == null) { return(BadRequest()); } var comments = await commentSerivce.Get10ByVideoIdAsync(page, id); var viewModel = Mapper.Map <List <CommentGetAllViewModel> >(comments); return(Json(viewModel)); }