public async Task Invalid_Search_Request_Should_Throw_ValidationException(int pageIndex, int pageSize)
        {
            var request = new GetCategoryCollectionRequest
            {
                PageSize  = pageSize,
                PageIndex = pageIndex
            };

            await Should.ThrowAsync <ValidationException>(async() =>
                                                          await this._testFixture.ExecuteTestRequestHandler <GetCategoryCollectionRequest, GetCategoryCollectionResult>(request, result => { }));
        }
        public async Task Should_GetCategoryCollection_With_SearchTerm_Correctly()
        {
            var category = this._testFixture.Category;
            var request  = new GetCategoryCollectionRequest
            {
                SearchTerm = category.DisplayName
            };

            await this._testFixture.ExecuteTestRequestHandler <GetCategoryCollectionRequest, GetCategoryCollectionResult>(request, (result) =>
            {
                result.ShouldNotBeNull();
                result.TotalCategories.ShouldBe(1);
                result.Categories.ShouldHaveSingleItem();
                var categoryResult = result.Categories.FirstOrDefault();
                categoryResult.Id.ShouldBe(category.CategoryId);
                categoryResult.DisplayName.ShouldBe(category.DisplayName);
            });
        }
        public async Task Should_Validate_Search_Request_Correctly(int pageIndex, int pageSize)
        {
            var request = new GetCategoryCollectionRequest
            {
                PageSize  = pageSize,
                PageIndex = pageIndex
            };

            await this._testFixture.ExecuteValidationTest(request, result =>
            {
                if (pageIndex < 0 || pageIndex == int.MaxValue)
                {
                    result.ShouldHaveValidationErrorFor(x => x.PageIndex);
                }

                if (pageSize < 0 || pageSize == int.MaxValue)
                {
                    result.ShouldHaveValidationErrorFor(x => x.PageSize);
                }
            });
        }