public void GetById_ListReturnedIsEmpty_VerifySqlServerDataAccess()
        {
            var fakeConfig = MakeFakeConfig();
            var stubSqlParameterBuilder = new StubISqlParameterBuilder();
            var mockSqlServerDataAccess = new MockISqlServerDataAccess();
            var sqlServerAdapter        = new BlogUserSqlServerAdapter(fakeConfig,
                                                                       mockSqlServerDataAccess, stubSqlParameterBuilder);
            var param_id = new BlogUserFactory().Create().UserId;

            mockSqlServerDataAccess.StubExecuteReaderStoredProcedure(new List <BlogUser>());

            sqlServerAdapter.GetById(param_id);

            mockSqlServerDataAccess.VerifyExecuteReaderStoredProcedureCalled <BlogUser>(1);
        }
        public void GetById_ListReturnedIsEmpty_ReturnsNullBlogUser()
        {
            var fakeConfig = MakeFakeConfig();
            var stubSqlParameterBuilder = new StubISqlParameterBuilder();
            var stubSqlServerDataAccess = new StubISqlServerDataAccess();
            var sqlServerAdapter        = new BlogUserSqlServerAdapter(fakeConfig,
                                                                       stubSqlServerDataAccess, stubSqlParameterBuilder);
            var param_id = new BlogUserFactory().Create().UserId;

            stubSqlServerDataAccess.StubExecuteReaderStoredProcedure(new List <BlogUser>());

            var returned_blogpost = sqlServerAdapter.GetById(param_id);

            Assert.Null(returned_blogpost);
        }
        public void GetById_ListReturnedContainsBlogUser_VerifySqlServerDataAccess()
        {
            var fakeConfig = MakeFakeConfig();
            var stubSqlParameterBuilder = new StubISqlParameterBuilder();
            var mockSqlServerDataAccess = new MockISqlServerDataAccess();
            var sqlServerAdapter        = new BlogUserSqlServerAdapter(fakeConfig,
                                                                       mockSqlServerDataAccess, stubSqlParameterBuilder);
            var stub_blogpost       = new BlogUserFactory().Create();
            var stub_listOfBlogUser = new List <BlogUser> {
                stub_blogpost
            };

            mockSqlServerDataAccess.StubExecuteReaderStoredProcedure(stub_listOfBlogUser);
            var param_id = stub_blogpost.UserId;

            var returned_blogpost = sqlServerAdapter.GetById(param_id);

            mockSqlServerDataAccess.VerifyExecuteReaderStoredProcedureCalled <BlogUser>(1);
        }
        public void GetById_ListReturnedContainsBlogUser_ReturnsExpectedBlogUser()
        {
            var fakeConfig = MakeFakeConfig();
            var stubSqlParameterBuilder = new StubISqlParameterBuilder();
            var stubSqlServerDataAccess = new StubISqlServerDataAccess();
            var sqlServerAdapter        = new BlogUserSqlServerAdapter(fakeConfig,
                                                                       stubSqlServerDataAccess, stubSqlParameterBuilder);
            var expected            = new BlogUserFactory().Create();
            var stub_listOfBlogUser = new List <BlogUser> {
                expected
            };

            stubSqlServerDataAccess.StubExecuteReaderStoredProcedure(stub_listOfBlogUser);
            var param_id = expected.UserId;

            var actual = sqlServerAdapter.GetById(param_id);

            Assert.Equal(expected, actual);
        }