예제 #1
0
        public async Task MakeMCommercePaymentAsync_Returns_Correct_ErrorMessage_For_422(string errorCode, string errorMessage, string content)
        {
            var mockHttp = MockHttp.WithStatusAndContent(422, content);
            var client   = new SwishClient(mockHttp, _merchantId);

            var result = await client.MakeMCommercePaymentAsync(_defaultMCommercePaymentModel);

            result.ErrorMessage.Should().Contain(errorMessage);
            result.ErrorCode.Should().Be(errorCode);
        }
예제 #2
0
        public async Task MakeECommercePayment_Throws_Swich_Exception_When_Status_Code_Is_422()
        {
            var errorMsg  = "Testing error";
            var mockHttp  = MockHttp.WithStatusAndContent(422, errorMsg);
            var client    = new SwishClient(mockHttp, _merchantId);
            var exception = await Assert.ThrowsAsync <HttpRequestException>(() =>
                                                                            client.MakeECommercePaymentAsync(_defaultECommercePaymentModel));

            Assert.Equal(errorMsg, exception.Message);
        }