public async Task Validation_Fail_ShouldThrowException()
        {
            var command = new UpdateCatalogCategoryCommand
            {
                CatalogId         = (CatalogId)Guid.Empty,
                CatalogCategoryId = (CatalogCategoryId)Guid.Empty,
                DisplayName       = this.Fixture.Create <string>()
            };

            await Should.ThrowAsync <ValidationException>(async() =>
                                                          await this._requestHandler.Handle(command, this.CancellationToken));
        }
        public async Task Update_CatalogCategory_Successfully()
        {
            var command = new UpdateCatalogCategoryCommand
            {
                CatalogId         = this._catalog.CatalogId,
                CatalogCategoryId = this._catalogCategory.CatalogCategoryId,
                DisplayName       = this.Fixture.Create <string>()
            };

            await this._requestHandler.Handle(command, this.CancellationToken);

            this._mockDbContext.Verify(x => x.Update(It.IsAny <Catalog>()), Times.Once);
        }
        public void Not_Found_Catalog_ShouldBeInvalid()
        {
            var command = new UpdateCatalogCategoryCommand
            {
                CatalogId         = IdentityFactory.Create <CatalogId>(),
                CatalogCategoryId = IdentityFactory.Create <CatalogCategoryId>(),
                DisplayName       = this.Fixture.Create <string>()
            };

            var result = this._validator.TestValidate(command);

            result.ShouldHaveValidationErrorFor(x => x.CatalogId);
            result.ShouldNotHaveValidationErrorFor(x => x.CatalogCategoryId);
            result.ShouldNotHaveValidationErrorFor(x => x.DisplayName);
        }
        public void Empty_DisplayName_ShouldBeInvalid()
        {
            var command = new UpdateCatalogCategoryCommand
            {
                CatalogId         = this._catalog.CatalogId,
                CatalogCategoryId = this._catalogCategory.CatalogCategoryId,
                DisplayName       = string.Empty
            };

            var result = this._validator.TestValidate(command);

            result.ShouldHaveValidationErrorFor(x => x.DisplayName);
            result.ShouldNotHaveValidationErrorFor(x => x.CatalogId);
            result.ShouldNotHaveValidationErrorFor(x => x.CatalogCategoryId);
        }