public void GetByIdTest_ReturnsNotFound_WhenIdNotProvided() { //act var result = _blogController.GetById(null); //asert Assert.IsAssignableFrom <NotFoundObjectResult>(result.Result); }
public async Task LoadBlogPost_Ok() { //Arrange var response = await _blogController.List(); var blogPosts = response.GetModelFromViewResultResponse <IEnumerable <BlogPostViewModel> >(); var blogPost = blogPosts.FirstOrDefault(); //Act var loadResponse = await _blogController.GetById(blogPost.Id); //Assert Assert.True(loadResponse is ContentResult); Assert.True(loadResponse.CastActionResult <ContentResult>().Content != null); }