public void IsValid_Empty_Guid() { // Arrange _command.Id = Guid.Empty; // Act var result = _command.IsValid(); // Assert Assert.False(result); }
public async Task <bool> Handle(DeleteInvoiceCommand request, CancellationToken cancellationToken) { if (!request.IsValid()) { await _mediatorHandler.RaiseEvent(new DomainValidationEvent(request.ValidationResult.ToString())); return(false); } var oldInvoice = _invoiceRepository.GetById(request.Id); if (oldInvoice == null) { await _mediatorHandler.RaiseEvent(new NotFoundEvent(request.Id, "Invoice", "Invoice not found")); return(false); } _invoiceRepository.Delete(request.Id); await _mediatorHandler.RaiseEvent(new InvoiceDeletedEvent() { Old = oldInvoice }); return(true); }