public void PostSpecificationValidTitleReturnDirectSpec() { //Arrange ISpecification <Post> spec = null; //Act spec = PostSpecifications.PostsContainsTitleOrContent("Title"); //assert Assert.IsType <AndSpecification <Post> >(spec); }
public void PostSpecificationNullTitleReturnTrueSpec() { //Arrange ISpecification <Post> spec = null; //Act spec = PostSpecifications.PostsContainsTitleOrContent(null); //assert Assert.IsType <TrueSpecification <Post> >(spec); }
public async Task <List <PostDTO> > GetAllDTOAsync(string q) { ISpecification <Post> specification = PostSpecifications.PostsContainsTitleOrContent(q); var posts = await _postRepository.AllMatchingAsync(specification); if (posts != null && posts.Any()) { return(posts.ProjectedAsCollection <PostDTO>()); } return(null); }