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)); }
public void Active_Product_With_Valid_Id() { _commandWithValidId.Validate(); Assert.AreEqual(_commandWithValidId.Valid, true); }
public void Active_Product_Without_Id() { _commandWithInvalidId.Validate(); Assert.AreEqual(_commandWithInvalidId.Valid, false); }