예제 #1
0
        public void CreatePositionAsync_should_throw_ArgumentException_if_futures_group_id_is_null_1()
        {
            //arrange
            var obj = new LeverageApi(TestHelper.CreateApiClientWithMockHttpAccessor());

            //act
            var actual = Record.ExceptionAsync(async() => await obj.CreatePositionAsync("futures", "btc_jpy", "bid", 0, 0, 0, groupId: null));

            //assert
            Assert.IsType <ArgumentException>(actual.Result);
        }
예제 #2
0
        public async void CreatePositionAsync_should_success(string jsonString, string type, string currencyPair,
                                                             string action, decimal amount, decimal price, decimal leverage, int?groupId, decimal?limit, decimal?stop)
        {
            //arrange
            var response = TestHelper.CreateJsonResponse(jsonString);

            var obj = new LeverageApi(TestHelper.CreateApiClientWithMockHttpAccessor(response));

            //act
            var actual = await obj.CreatePositionAsync(type, currencyPair, action, amount, price, leverage, groupId, limit, stop);

            //assert
            Assert.NotNull(actual);
            Assert.IsAssignableFrom <CreatePositionResponse>(actual);
        }
예제 #3
0
        public void CreatePositionAsync_should_throw_ArgumentException_if_futures_group_id_is_null_2()
        {
            //arrange
            var obj        = new LeverageApi(TestHelper.CreateApiClientWithMockHttpAccessor());
            var parameters = new Dictionary <string, string>
            {
                { "type", "futures" },
                { "currency_pair", "btc_jpy" },
                { "action", "bid" },
                { "price", "0" },
                { "amount", "0" },
                { "leverage", "0" }
            };

            //act
            var actual = Record.ExceptionAsync(async() => await obj.CreatePositionAsync(parameters));

            //assert
            Assert.IsType <ArgumentException>(actual.Result);
        }