コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: trendsales/freepay-mock
 public async Task ChangeCaptureAmountAsync()
 {
     using (TestServer server = TestServer.Create <Startup>())
     {
         var client = new ManagementClient(server.HttpClient);
         await client.ChangeCaptureAmountAsync(1, "password", 20000);
     };
 }
コード例 #2
0
        public async Task ChangeCaptureAmount_OK_Success()
        {
            int    transactionId = 534536434;
            string password      = "******";
            int    amount        = 2000;

            var mockHttp = new MockHttpMessageHandler();

            mockHttp.When(Urls.GetChangeCaptureAmountUrl(transactionId, password, amount))
            .Respond(HttpStatusCode.OK);
            // 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);
            await client.ChangeCaptureAmountAsync(transactionId, password, amount);
        }