public void GetAllLedgerEntriesExpected() { 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 <LedgerEntryBase> >(It.IsAny <IRestRequest>())).Returns <IRestRequest>(request => { var responseMock = new Mock <IRestResponse <ResponseCollection <LedgerEntryBase> > >(MockBehavior.Strict); responseMock.SetupAllProperties(); responseMock.Object.Content = Properties.Resources.LedgerResponse; responseMock.Object.Request = request; responseMock.Object.Data = deserializer.Deserialize <ResponseCollection <LedgerEntryBase> >(responseMock.Object); return(responseMock.Object); }); var client = new BitsoClient(restMock.Object, ServiceUrlMock, ApiKeyMock, ApiSecretMock); var res = client.GetAllLedgerEntries(); Assert.IsNotNull(res); Assert.AreNotEqual <int>(0, res.Count); Assert.AreNotEqual <int>(0, res[0].Balances.Count); Assert.AreNotEqual <TransactionType>(TransactionType.None, res[0].Kind); Assert.IsFalse(string.IsNullOrEmpty(res[0].Id)); Assert.IsFalse(string.IsNullOrEmpty(res[0].Balances[0].Currency)); res = client.GetAllLedgerEntries(string.Empty, SortDirection.Ascending, 7); Assert.IsNotNull(res); Assert.AreEqual <int>(7, res.Count); }
public void GetAllLedgerEntriesExpected() { using (var client = new BitsoClient(this.TestingServerUrl, this.ApiKey, this.ApiSecret)) { try { var res = client.GetAllLedgerEntries(); Assert.IsNotNull(res); Assert.AreNotEqual <int>(0, res.Count); Assert.AreNotEqual <int>(0, res[0].Balances.Count); Assert.AreNotEqual <TransactionType>(TransactionType.None, res[0].Kind); Assert.IsFalse(string.IsNullOrEmpty(res[0].Id)); Assert.IsFalse(string.IsNullOrEmpty(res[0].Balances[0].Currency)); res = client.GetAllLedgerEntries(string.Empty, SortDirection.Ascending, 5); Assert.IsNotNull(res); Assert.AreEqual <int>(5, res.Count); } catch (BitsoException ex) { this.TestContext.WriteLine(ex.Header); throw; } } }