Example #1
0
        public async Task ExistsAsync_Should_Return_Result_Matching_Expectations(string pattern, bool expectedResult)
        {
            var specification = new UserSeachSpecification
            {
                NamePattern = pattern
            };

            (await _underTest.ExistsAsync(specification)).Should().Be(expectedResult);
        }
Example #2
0
        public async Task GetAsync_With_Projection_When_Result_Is_Not_Empty_Should_Return_Matching_Result(string pattern, int expectedId)
        {
            var specification = new UserSeachSpecification
            {
                NamePattern = pattern
            };

            (await _underTest.GetAsync(specification, x => x.Id)).Should().Be(expectedId);
        }
Example #3
0
        public async Task ListAsync_When_Records_Not_Found_Should_Return_Empty_Result()
        {
            var specification = new UserSeachSpecification
            {
                NamePattern = "Dragon"
            };

            (await _underTest.ListAsync(specification)).Should().BeEmpty();
        }
Example #4
0
        public async Task CountAsync_When_Records_Not_Found_Should_Return_Zero()
        {
            var specification = new UserSeachSpecification
            {
                NamePattern = "Dragon"
            };

            (await _underTest.CountAsync(specification)).Should().Be(0);
        }
Example #5
0
        public async Task ListAsync_With_Projection_When_Paging_Used_Should_Return_Valid_Portion_Of_Data()
        {
            var specification = new UserSeachSpecification
            {
                SortByNameAsc = false
            };

            (await _underTest.ListAsync(specification, x => x.Id, 2, 1)).Should().BeEquivalentTo(1);
        }
Example #6
0
        public async Task GetAsync_When_Record_Not_Found_Should_Return_Null()
        {
            var specification = new UserSeachSpecification
            {
                NamePattern = "Sveta"
            };

            (await _underTest.GetAsync(specification)).Should().BeNull();
        }
Example #7
0
        public async Task CountAsync_When_Result_Is_Not_Empty_Should_Return_Matching_Items_In_Valid_Sort_Order()
        {
            var specification = new UserSeachSpecification
            {
                NamePattern   = "a",
                SortByNameAsc = true
            };

            (await _underTest.CountAsync(specification)).Should().Be(2);
        }
Example #8
0
        public async Task ListAsync_When_Paging_Used_Should_Return_Valid_Portion_Of_Data()
        {
            var specification = new UserSeachSpecification
            {
                SortByNameAsc = false
            };

            (await _underTest.ListAsync(specification, 2, 1)).Should().BeEquivalentTo(new User {
                Id = 1, Name = "Andrei"
            });
        }
Example #9
0
        public async Task ListAsync_When_Result_Is_Not_Empty_Should_Return_Matching_Items_In_Valid_Sort_Order()
        {
            var specification = new UserSeachSpecification
            {
                NamePattern   = "a",
                SortByNameAsc = true
            };

            (await _underTest.ListAsync(specification)).Should().BeEquivalentTo(new[]
            {
                new User {
                    Id = 2, Name = "Raman"
                },
                new User {
                    Id = 3, Name = "Stuart"
                }
            });
        }