Beispiel #1
0
        public async Task AndThereIsAInvalidPayment_Return400_AndReturnValidationErrors()
        {
            var cultureCode = "en-GB";
            var rawPayment  = string.Empty;

            var validationErrors = new ValidationErrors();

            validationErrors.AddParsingError("amount: incorrect value");

            var paymentServiceMock = new Mock <IPaymentService>();

            paymentServiceMock.Setup(x => x.CreatePayments(It.IsAny <string>(), It.IsAny <string>())).ReturnsAsync(validationErrors);

            var sut = new PaymentController(paymentServiceMock.Object, _loggerMock.Object);

            IActionResult result = await sut.Put(rawPayment, cultureCode);

            result.Should().BeOfType <BadRequestObjectResult>();
        }