public void FACTORY_Can_create_valid_post() { //Arrange //Act var post = PostFactory.factory("Title", "Body", null); //Assert Assert.IsNotNullOrEmpty(post.title); Assert.IsNotNullOrEmpty(post.body); Assert.IsNotNullOrEmpty(post.preview); Assert.LessOrEqual(post.preview.Length, 50); }
public Post AddPost(Web.Models.PostVM newPostVM) { Post post = PostFactory.factory(newPostVM.title, newPostVM.body, newPostVM.tags); //new Post(); post.body = newPostVM.body; post.title = newPostVM.title; if (!(null == newPostVM.tags)) { post.tags = new List <string>(newPostVM.tags); } return(post); }