Exemple #1
0
        public void GetAccountFeesExpected()
        {
            using (var client = new BitsoClient(this.TestingServerUrl, this.ApiKey, this.ApiSecret))
            {
                try
                {
                    var res = client.GetAccountFees();
                    Assert.IsNotNull(res);
                    Assert.AreNotEqual <int>(0, res.TradeFees.Count);

                    Assert.IsFalse(string.IsNullOrEmpty(res.TradeFees[0].BookName));
                    Assert.AreNotEqual <decimal>(0M, res.TradeFees[0].TakerPercent);
                    Assert.AreNotEqual <decimal>(0M, res.TradeFees[0].TakerValue);
                    Assert.AreNotEqual <decimal>(0M, res.TradeFees[0].MakerPercent);
                    Assert.AreNotEqual <decimal>(0M, res.TradeFees[0].MakerValue);
                    Assert.AreNotEqual <int>(0, res.WithdrawalFees.Count);
                    Assert.AreNotEqual <decimal>(0M, res.WithdrawalFees.First().Value);
                }
                catch (BitsoException ex)
                {
                    this.TestContext.WriteLine(ex.Header);
                    throw;
                }
            }
        }
Exemple #2
0
        public void GetAccountFeesExpected()
        {
            IDeserializer deserializer = null;

            var restMock = new Mock <IRestClient>(MockBehavior.Strict);

            restMock.SetupAllProperties();
            restMock.Setup(x => x.AddHandler("application/json", It.IsAny <IDeserializer>())).Callback <string, IDeserializer>((ct, d) => deserializer = d);

            restMock.Setup(x => x.Execute <ResponseSingle <AccountFees> >(It.IsAny <IRestRequest>())).Returns <IRestRequest>(request =>
            {
                var responseMock = new Mock <IRestResponse <ResponseSingle <AccountFees> > >(MockBehavior.Strict);
                responseMock.SetupAllProperties();

                responseMock.Object.Content = Properties.Resources.AccountFeesResponse;
                responseMock.Object.Request = request;
                responseMock.Object.Data    = deserializer.Deserialize <ResponseSingle <AccountFees> >(responseMock.Object);

                return(responseMock.Object);
            });

            var client = new BitsoClient(restMock.Object, ServiceUrlMock, ApiKeyMock, ApiSecretMock);

            var res = client.GetAccountFees();

            Assert.IsNotNull(res);
            Assert.AreNotEqual <int>(0, res.TradeFees.Count);

            Assert.IsFalse(string.IsNullOrEmpty(res.TradeFees[0].BookName));
            Assert.AreNotEqual <decimal>(0M, res.TradeFees[0].TakerPercent);
            Assert.AreNotEqual <decimal>(0M, res.TradeFees[0].TakerValue);
            Assert.AreNotEqual <decimal>(0M, res.TradeFees[0].MakerPercent);
            Assert.AreNotEqual <decimal>(0M, res.TradeFees[0].MakerValue);
            Assert.AreNotEqual <int>(0, res.WithdrawalFees.Count);
            Assert.AreNotEqual <decimal>(0M, res.WithdrawalFees.First().Value);
        }