public void DeleteBlogPost_ValidBlogPost_ReturnsExpectedResponse() { var stubBlogPostRepo = new StubIBlogPostRepository(); var interactor = new DeleteBlogPostInteractor(stubBlogPostRepo); var stub_BlogPost = new BlogPostFactory().Create(); stubBlogPostRepo.StubGetById(stub_BlogPost); var expected = MakeResponse(true); var param_request = MakeRequest(stub_BlogPost); var actual = interactor.DeleteBlogPost(param_request); Assert.Equal(expected.DeleteSuccessful, actual.DeleteSuccessful); }
public void AddBlogPost_ValidBlogPost_ReturnsExpectedResponse() { var stubBlogPostRepo = new StubIBlogPostRepository(); var interactor = new AddBlogPostInteractor(stubBlogPostRepo); var stub_BlogPost = new BlogPostFactory().Create(); var expected = MakeResponse(stub_BlogPost, true); var param_request = MakeRequest(stub_BlogPost); var actual = interactor.AddBlogPost(param_request); Assert.Equal(expected.AddSuccessful, actual.AddSuccessful); Assert.Equal(expected.Post.AuthorId, actual.Post.AuthorId); Assert.Equal(expected.Post.PostBody, actual.Post.PostBody); Assert.Equal(expected.Post.PostTitle, actual.Post.PostTitle); }
public void ListBlogPosts_ReturnsExpectedResponse() { var stubBlogPostRepo = new StubIBlogPostRepository(); var interactor = new ListBlogPostsInteractor(stubBlogPostRepo); var stub_BlogPost = new BlogPostFactory().Create(); var stub_listOfPosts = new List <BlogPost> { stub_BlogPost }; stubBlogPostRepo.StubList(stub_listOfPosts); var expected = MakeResponse(stub_listOfPosts, true); var param_request = MakeRequest(stub_BlogPost); var actual = interactor.ListBlogPosts(param_request); Assert.Equal(expected.RequestSuccessful, actual.RequestSuccessful); Assert.Equal(expected.ListOfPosts, actual.ListOfPosts); }
public void GetBlogPost_VerifyBlogUserRepository() { var stubBlogPostRepo = new StubIBlogPostRepository(); var mockBlogUserRepo = new MockIBlogUserRepository(); var interactor = new GetBlogPostInteractor(stubBlogPostRepo, mockBlogUserRepo); var stub_BlogPost = new BlogPostFactory().Create(); var stub_BlogUser = new BlogUserFactory().Create(); stub_BlogPost.AuthorId = stub_BlogUser.UserId; stubBlogPostRepo.StubGetById(stub_BlogPost); mockBlogUserRepo.StubGetById(stub_BlogUser); var expected = MakeResponse(stub_BlogPost, stub_BlogUser, true); var param_request = MakeRequest(stub_BlogPost); var response = interactor.GetBlogPost(param_request); mockBlogUserRepo.VerifyGetById(stub_BlogUser.UserId); }
public void GetBlogPost_ValidBlogPostAndUser_ReturnsExpectedResponse() { var stubBlogPostRepo = new StubIBlogPostRepository(); var stubBlogUserRepo = new StubIBlogUserRepository(); var interactor = new GetBlogPostInteractor(stubBlogPostRepo, stubBlogUserRepo); var stub_BlogPost = new BlogPostFactory().Create(); var stub_BlogUser = new BlogUserFactory().Create(); stub_BlogPost.AuthorId = stub_BlogUser.UserId; stubBlogPostRepo.StubGetById(stub_BlogPost); stubBlogUserRepo.StubGetById(stub_BlogUser); var expected = MakeResponse(stub_BlogPost, stub_BlogUser, true); var param_request = MakeRequest(stub_BlogPost); var actual = interactor.GetBlogPost(param_request); Assert.Equal(expected.RequestSuccessful, actual.RequestSuccessful); Assert.Equal(expected.Post, actual.Post); Assert.Equal(expected.User, actual.User); }