예제 #1
0
        public async Task CreateExcode_LoginIsNull()
        {
            _fakeHttpMessageHandler.HandleRequestAsync = TestHelper.HandleContent(form =>
            {
                Assert.Equal("BTC", form["currency"]);
                Assert.Equal("0.1", form["amount"]);
                Assert.DoesNotContain("login", form.AllKeys);
            });
            _fakeHttpMessageHandler.ResponseMessage = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent("{\"result\":true,\"error\":\"\",\"task_id\":\"467757\",\"code\":\"EX-CODE_9004_BTC7c3f8adc0b158658....\",\"amount\":\"0.1\",\"currency\":\"BTC\",\"commission\":\"0.01\",\"balances\":{\"BTC\":940.994,\"USD\":949.472}}")
            };

            var request = new CreateExcodeRequest
            {
                Currency = "BTC",
                Amount   = 0.1m
            };
            var result = await _authenticatedApi.CreateExcodeAsync(request);

            Assert.Equal(467757, result.TaskId);
            Assert.Equal("EX-CODE_9004_BTC7c3f8adc0b158658....", result.Code);
            Assert.Equal(0.1m, result.Amount);
            Assert.Equal("BTC", result.Currency);
            Assert.Null(result.Login);
            Assert.Equal(0.01m, result.Commission);
            Assert.Equal(940.994m, result.Balances["BTC"]);
            Assert.Equal(949.472m, result.Balances["USD"]);
        }
예제 #2
0
 public Task <CreateExcodeResult> CreateExcodeAsync(CreateExcodeRequest request, CancellationToken cancellationToken = default)
 {
     return(_client.PostAsync <CreateExcodeResult>("excode_create", request, cancellationToken));
 }