Beispiel #1
0
        public void GetTradesExpected()
        {
            var client = new BitsoClient(this.TestingServerUrl);

            var res = client.GetTrades("btc_mxn");

            Assert.AreNotEqual <int>(0, res.Count);
            Assert.AreNotEqual <decimal>(0, res[0].Amount);
            Assert.IsFalse(string.IsNullOrEmpty(res[0].BookName));

            Assert.IsTrue(res[0].MakerSide != MarketSide.None);
            Assert.AreNotEqual <decimal>(0M, res[0].Price);
            Assert.AreNotEqual <decimal>(0M, res[0].Amount);
            Assert.AreNotEqual <long>(0, res[0].TradeId);

            var diff = res[0].CreatedAt - default(System.DateTime);

            Assert.IsTrue(diff > System.TimeSpan.Zero);
        }
Beispiel #2
0
        public void GetTradesExpected()
        {
            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 <ResponseCollection <TradeInfo> >(It.IsAny <IRestRequest>())).Returns <IRestRequest>(request =>
            {
                var responseMock = new Mock <IRestResponse <ResponseCollection <TradeInfo> > >(MockBehavior.Strict);
                responseMock.SetupAllProperties();

                responseMock.Object.Content = Properties.Resources.TradesInfoResponse;
                responseMock.Object.Request = request;
                responseMock.Object.Data    = deserializer.Deserialize <ResponseCollection <TradeInfo> >(responseMock.Object);

                return(responseMock.Object);
            });

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

            var res = client.GetTrades("btc_mxn");

            Assert.AreNotEqual <int>(0, res.Count);
            Assert.AreNotEqual <decimal>(0, res[0].Amount);
            Assert.IsFalse(string.IsNullOrEmpty(res[0].BookName));

            Assert.IsTrue(res[0].MakerSide != MarketSide.None);
            Assert.AreNotEqual <decimal>(0M, res[0].Price);
            Assert.AreNotEqual <decimal>(0M, res[0].Amount);
            Assert.AreNotEqual <long>(0, res[0].TradeId);

            var diff = res[0].CreatedAt - default(System.DateTime);

            Assert.IsTrue(diff > System.TimeSpan.Zero);
        }