예제 #1
0
        public void Add_ValidBlogUser_Returns()
        {
            var stubDataAccessAdapter = new StubIBlogUserDataAccessAdapter();
            var stubValidator         = new StubIBlogUserValidator();
            var repository            = new BlogUserRepository(stubDataAccessAdapter, stubValidator);
            var param_blogUser        = new BlogUserFactory().Create();

            repository.Add(param_blogUser);
        }
예제 #2
0
        public void Edit_ValidBlogUser_VerifyValidator()
        {
            var stubDataAccessAdapter = new StubIBlogUserDataAccessAdapter();
            var mockValidator         = new MockIBlogUserValidator();
            var repository            = new BlogUserRepository(stubDataAccessAdapter, mockValidator);
            var param_blogUser        = new BlogUserFactory().Create();

            repository.Edit(param_blogUser);

            mockValidator.VerifyValidateBlogUser(param_blogUser);
        }
예제 #3
0
        public void GetById_ValidBlogUser_ReturnsExpectedBlogUser()
        {
            var stubDataAccessAdapter = new StubIBlogUserDataAccessAdapter();
            var stubValidator         = new StubIBlogUserValidator();
            var repository            = new BlogUserRepository(stubDataAccessAdapter, stubValidator);
            var expected = new BlogUserFactory().Create();

            stubDataAccessAdapter.StubGetById(expected);
            var param_userId = expected.UserId;

            var actual = repository.GetById(param_userId);

            Assert.Equal(expected, actual);
        }
예제 #4
0
        public void List_ValidBlogUser_ReturnsExpectedList()
        {
            var stubDataAccessAdapter = new StubIBlogUserDataAccessAdapter();
            var stubValidator         = new StubIBlogUserValidator();
            var repository            = new BlogUserRepository(stubDataAccessAdapter, stubValidator);
            var expected = new List <BlogUser> {
                new BlogUserFactory().Create()
            };

            stubDataAccessAdapter.StubList(expected);

            var actual = repository.List();

            Assert.Equal(expected, actual);
        }