public ActionResult Deactivate(DeactivatePaymentLevelCommand data) { var validationResult = _paymentLevelCommands.ValidatePaymentLevelCanBeDeactivated(data); if (!validationResult.IsValid) { return(ValidationErrorResponseActionResult(validationResult.Errors)); } _paymentLevelCommands.Deactivate(data); return(this.Success()); }
public void Can_deactivate_payment_level() { var createPaymentLevelData = CreatePaymentLevelData(); var id = _paymentLevelCommands.Save(createPaymentLevelData).PaymentLevelId; var deactivatePaymentLevelCommand = new DeactivatePaymentLevelCommand { Id = id }; var canDeactivate = _paymentLevelCommands.ValidatePaymentLevelCanBeDeactivated(deactivatePaymentLevelCommand); Assert.That(canDeactivate.IsValid, Is.True); _paymentLevelCommands.Deactivate(deactivatePaymentLevelCommand); var newStatus = _paymentRepository.PaymentLevels.Single(x => x.Id == id).Status; Assert.That(newStatus, Is.EqualTo(PaymentLevelStatus.Inactive)); }