public void LoginUser_VerifyRepository() { var mockBlogUserRepo = new MockIBlogUserRepository(); var interactor = new LoginUserInteractor(mockBlogUserRepo); var param_request = MakeRequest("Poptart"); mockBlogUserRepo.StubList(new List <BlogUser>()); interactor.LoginUser(param_request); mockBlogUserRepo.VerifyList(); }
public void RegisterUser_UserNameIsAvailable_VerifyRepository() { var mockBlogUserRepo = new MockIBlogUserRepository(); var interactor = new RegisterUserInteractor(mockBlogUserRepo); mockBlogUserRepo.StubList(new List <BlogUser>()); var param_request = new RegisterUserRequest { UserName = "******" }; interactor.RegisterUser(param_request); mockBlogUserRepo.VerifyList(); mockBlogUserRepo.VerifyAddCalled(1); }
public void ListBlogUsers_VerifyBlogUserRepository() { var mockBlogUserRepo = new MockIBlogUserRepository(); var interactor = new ListBlogUsersInteractor(mockBlogUserRepo); var stub_BlogUser = new BlogUserFactory().Create(); var stub_listOfUsers = new List <BlogUser> { stub_BlogUser }; mockBlogUserRepo.StubList(stub_listOfUsers); var expected = MakeResponse(stub_listOfUsers, true); var param_request = MakeRequest(stub_BlogUser); var response = interactor.ListBlogUsers(param_request); mockBlogUserRepo.VerifyList(); }
public void RegisterUser_UserNameIsNotAvailable_VerifyRepository() { var mockBlogUserRepo = new MockIBlogUserRepository(); var interactor = new RegisterUserInteractor(mockBlogUserRepo); var stub_blogUser = new BlogUserFactory().Create(); mockBlogUserRepo.StubList(new List <BlogUser> { stub_blogUser }); var param_request = new RegisterUserRequest { UserName = stub_blogUser.UserName }; var actual = interactor.RegisterUser(param_request); mockBlogUserRepo.VerifyList(); mockBlogUserRepo.VerifyAddNeverCalled(); }
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); }