public async Task <ICommandResult> HandleAsync(ActiveProductCommand command)
        {
            command.Validate();
            if (command.Invalid)
            {
                return(new GenericCommandResult <ProductEntity>(false, command.Notifications));
            }

            var product = await _repository.GetAsync(command.Id);

            product.Active();

            await _repository.UpdateAsync(product);

            return(new GenericCommandResult <ProductEntity>(true, product));
        }
示例#2
0
        public void Active_Product_With_Valid_Id()
        {
            _commandWithValidId.Validate();

            Assert.AreEqual(_commandWithValidId.Valid, true);
        }
示例#3
0
        public void Active_Product_Without_Id()
        {
            _commandWithInvalidId.Validate();

            Assert.AreEqual(_commandWithInvalidId.Valid, false);
        }