Esempio n. 1
0
        public async Task GetPayouts_OK_HasCorrectData(int count)
        {
            var payout = new Payout
            {
                To            = "address",
                SatoshiAmount = 100,
                Date          = new DateTime(2020, 1, 1, 1, 1, 1, DateTimeKind.Utc)
            };
            var expectedResult = Enumerable.Range(1, count).Select(x => payout).ToList().ToExpectedObject();

            const string payoutJson       = @"{
    ""to"": ""address"",
    ""amount"": 100,
    ""date"": ""01-01-20 01:01:01 GMT""
}";
            var          payoutJsonParsed = JObject.Parse(payoutJson);
            const string json             = @"{
    ""status"": 200,
    ""message"": ""OK"",
    ""rewards"": []
}";

            var jsonParsed = JObject.Parse(json);

            for (int i = 0; i < count; i++)
            {
                ((JArray)jsonParsed["rewards"]).Add(payoutJsonParsed);
            }
            var finalJson = jsonParsed.ToString();

            // Act
            var client       = new MockRequester("payouts", finalJson).CreateClient();
            var actualResult = await client.GetPayouts(count, FaucetPayClient.Bitcoin);

            expectedResult.ShouldMatch(actualResult);
        }
Esempio n. 2
0
        public async Task GetPayouts_OutOfRange_ThrowsArgumentOutOfRangeException(int count)
        {
            var client = new MockRequester("payouts", null).CreateClient();

            await Assert.ThrowsAsync <ArgumentOutOfRangeException>(() => client.GetPayouts(count, FaucetPayClient.Bitcoin));
        }