Ejemplo n.º 1
0
        public async Task Capture_OK_Success()
        {
            int    transactionId = 534536434;
            string password      = "******";

            var mockXmlResponse =
                @"<?xml version='1.0' encoding='utf-8'?>
<TransactionResult xmlns=""http://gw.freepay.dk/WebServices/Public/Management"">
  <AcquirerStatusCode>234</AcquirerStatusCode>
  <IsSuccess>true</IsSuccess>
</TransactionResult>";
            var mockHttp = new MockHttpMessageHandler();

            mockHttp.When(Urls.GetCaptureUrl(transactionId, password))
            .Respond("text/xml", mockXmlResponse);
            // Inject the handler or client into your application code
            var httpClient = new HttpClient(mockHttp)
            {
                BaseAddress = new Uri("https://gw.freepay.dk")
            };
            IManagementClient client = new ManagementClient(httpClient);
            var result = await client.CaptureAsync(transactionId, password);

            Assert.NotNull(result);
            Assert.AreEqual(234, result.AcquirerStatusCode);
            Assert.True(result.IsSuccess);
        }
Ejemplo n.º 2
0
 public async Task CaptureAsync()
 {
     using (TestServer server = TestServer.Create <Startup>())
     {
         var client = new ManagementClient(server.HttpClient);
         await client.CaptureAsync(1, "password");
     };
 }