public void When_ApiReturnsNAlertss_AlertsListContainsNAlerts(string responseJson, int alertsCount) { // arrange var mockHttp = new MockHttpMessageHandler(); mockHttp.When($"*{Endpoints.Alerts}") .Respond(MediaTypes.ApplicationJson, responseJson); // act var bfClient = new BitfinexApiClient(Config.ApiKey, Config.SecretKey, new HttpClient(mockHttp)); var alerts = bfClient.GetAlertsAsync().Result; // assert Assert.AreEqual(alerts.Count, alertsCount); }
static void Main(string[] args) { BitfinexApiClient bfRestClient = new BitfinexApiClient(Config.ApiKey, Config.SecretKey, new HttpClient()); var platformStatus = bfRestClient.GetPlatformStatusAsync().Result; Console.WriteLine($"API State (1=up / 0=down): {platformStatus.Operative}"); var alerts = bfRestClient.GetAlertsAsync().Result; Console.WriteLine("Alerts:"); alerts.ForEach(alert => Console.WriteLine(alert.ToString())); var wallets = bfRestClient.GetWalletsAsync().Result; Console.WriteLine("Wallets:"); wallets.ForEach(wallet => Console.WriteLine(wallet.ToString())); Console.ReadLine(); }
public void When_ApiReturnsAlertAsJson_Expect_AlertWithSameData(string responseJson, string id, string type, string symbol, double price, int unknown) { // arrange var mockHttp = new MockHttpMessageHandler(); mockHttp.When($"*{Endpoints.Alerts}") .Respond(MediaTypes.ApplicationJson, responseJson); // act var bfClient = new BitfinexApiClient(Config.ApiKey, Config.SecretKey, new HttpClient(mockHttp)); var alerts = bfClient.GetAlertsAsync().Result; var alert = alerts.FirstOrDefault(); // assert Assert.IsNotNull(alert); Assert.AreEqual(alert.Id, id); Assert.AreEqual(alert.Type, type); Assert.AreEqual(alert.Symbol, symbol); Assert.AreEqual(alert.Price, price); Assert.AreEqual(alert.Unknown, unknown); }