public void GetTickerExpected1() { var client = new BitsoClient(this.TestingServerUrl); var res = client.GetTicker("btc_mxn"); Assert.IsNotNull(res); Assert.IsFalse(string.IsNullOrWhiteSpace(res.BookName)); Assert.AreNotEqual <decimal>(0M, res.Ask); Assert.AreNotEqual <decimal>(0M, res.Bid); Assert.AreNotEqual <decimal>(0M, res.VolumeWeightedAveragePrice); Assert.AreNotEqual <decimal>(0M, res.Low); Assert.AreNotEqual <decimal>(0M, res.High); Assert.AreNotEqual <decimal>(0M, res.Last); Assert.AreNotEqual <decimal>(0M, res.Volume); var diff = res.CreatedAt - default(System.DateTime); Assert.IsTrue(diff > System.TimeSpan.Zero); }
public void GetTickerExpected() { 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 <Ticker> >(It.IsAny <IRestRequest>())).Returns <IRestRequest>(request => { var responseMock = new Mock <IRestResponse <ResponseSingle <Ticker> > >(MockBehavior.Strict); responseMock.SetupAllProperties(); responseMock.Object.Content = Properties.Resources.TickerResponse; responseMock.Object.Request = request; responseMock.Object.Data = deserializer.Deserialize <ResponseSingle <Ticker> >(responseMock.Object); return(responseMock.Object); }); var client = new BitsoClient(restMock.Object, ServiceUrlMock, ApiKeyMock, ApiSecretMock); var res = client.GetTicker("btc_mxn"); Assert.IsNotNull(res); Assert.IsFalse(string.IsNullOrWhiteSpace(res.BookName)); Assert.AreNotEqual <decimal>(0M, res.Ask); Assert.AreNotEqual <decimal>(0M, res.Bid); Assert.AreNotEqual <decimal>(0M, res.VolumeWeightedAveragePrice); Assert.AreNotEqual <decimal>(0M, res.Low); Assert.AreNotEqual <decimal>(0M, res.High); Assert.AreNotEqual <decimal>(0M, res.Last); Assert.AreNotEqual <decimal>(0M, res.Volume); var diff = res.CreatedAt - default(System.DateTime); Assert.IsTrue(diff > System.TimeSpan.Zero); }