public async Task Handler_GivenNonExistingId_ShouldThrowEntityNotFoundException() { var query = new GetPaymentDetailsQuery { PaymentId = Guid.NewGuid() }; var sut = new GetPaymentDetailsQuery.Handler(DbContext, Mapper); await Should.ThrowAsync <EntityNotFoundException>(async() => await sut.Handle(query, CancellationToken.None)); }
public async Task Handler_GivenValidRequest_ShouldReturnPaymentDetails() { var query = new GetPaymentDetailsQuery { PaymentId = Constants.Sample1 }; var sut = new GetPaymentDetailsQuery.Handler(DbContext, Mapper); var result = await sut.Handle(query, CancellationToken.None); result.ShouldBeOfType <PaymentDto>(); result.Id.ShouldBe(Constants.Sample1); result.MerchantId.ShouldBe(1); result.CardHolderName.ShouldBe("John Smith"); result.CardNumber.ShouldNotBe("1111222233334444"); result.ExpiryYearMonth.ShouldBe("05/20"); result.Cvv.ShouldBe("298"); result.Amount.ShouldBe(200m); result.Currency.ShouldBe("GBP"); }