Beispiel #1
0
        public async Task Send_OK_HasCorrectData()
        {
            const string currency       = FaucetPayClient.Bitcoin;
            const string json           = @"{
    ""status"": 200,
    ""message"": ""OK"",
    ""rate_limit_remaining"": 1,
    ""currency"": ""BTC"",
    ""balance"": ""4321"",
    ""balance_bitcoin"": ""0.00004321"",
    ""payout_id"": 1234,
    ""payout_user_hash"": ""hash""
}";
            var          expectedResult = new SendResponse
            {
                RateLimitRemaining      = 1,
                Currency                = currency,
                RemainingSatoshiBalance = 4321,
                RemainingActualBalance  = 0.00004321m,
                PayoutId                = 1234,
                PayoutUserHash          = "hash"
            }.ToExpectedObject();

            var client       = new MockRequester("send", json).CreateClient();
            var actualResult = await client.Send(6789, "address", currency);

            expectedResult.ShouldMatch(actualResult);
        }
Beispiel #2
0
        public async Task Send_WithFailInterceptor_ThrowsInterceptorFailException()
        {
            var client = new MockRequester(new ApiConfig
            {
                SendInterceptors = new [] { new CustomResultSendInterceptor(InterceptorResult.Fail("fail!")) }
            }, "send", null).CreateClient();

            await Assert.ThrowsAsync <InterceptorFailException>(() => client.Send(6789, "address", FaucetPayClient.Bitcoin));
        }