public async Task <IActionResult> NewDonation([FromBody] NewDonationRequest request) { await _donationReceivedCommandHandler.HandleAsync( new DonationReceivedCommand { Name = request.Name, PostCode = request.PostCode, DonationAmount = request.DonationAmount }); return(Ok()); }
public void CanHandleCommand() { // Arrange var command = new DonationReceivedCommand { Name = "Test User", PostCode = "AB12CD", DonationAmount = 2.0m }; var commandHandler = new DonationReceivedCommandHandler(new DonationInMemoryRepository()); // Act AsyncTestDelegate act = async() => await commandHandler.HandleAsync(command); // Assert Assert.DoesNotThrowAsync(act); }