Пример #1
0
        public async Task GetPageAsync_should_return_2_posts_when_page_is_2_and_pageSize_is_2()
        {
            // arrange
            var user = await TestDataInitializer.InitOneGeneralUserAsync(_context);

            await TestDataInitializer.Init5PostsWith1DeletedPost(_context, user);

            //act
            var result = await _postRepository.GetPageAsync(1, 2, 2, false, null);

            //assert
            Assert.Equal(2, result.Data.Count);
        }
Пример #2
0
        public async Task FindAsync_should_return_null_if_post_is_deleted()
        {
            // arrange
            var user = await TestDataInitializer.InitOneGeneralUserAsync(_context);

            await TestDataInitializer.Init5PostsWith1DeletedPost(_context, user);

            //act
            var result = await _postRepository.FindValidAsync(p => p.IsDeleted);

            //assert
            Assert.Equal(0, result.Count);
        }
Пример #3
0
        public async Task GetAllAsync_should_return_4_posts_when_database_has_5_posts_with_1_deleted_Post()
        {
            // arrange
            var user = await TestDataInitializer.InitOneGeneralUserAsync(_context);

            await TestDataInitializer.Init5PostsWith1DeletedPost(_context, user);

            //act
            var result = await _postRepository.GetAllAsync();

            //assert
            Assert.Equal(4, result.Count);
        }