public void Can_get_all_institutions() { // Arrange const int limit = 5; var request = new Institution.SearchAllRequest() { Take = limit }; request.CountryCodes = new string[] { "US" }; request.UseDefaults(); var sut = new PlaidClient(Environment.Sandbox); // Act var response1 = sut.FetchAllInstitutionsAsync(request).Result; request.Take = 1; request.Skip = limit; var response2 = sut.FetchAllInstitutionsAsync(request).Result; var page = response1.Institutions.Select(x => x.Id).ToArray(); var nextItem = response2.Institutions.First().Id; // Assert response1.IsSuccessStatusCode.ShouldBeTrue(); response2.IsSuccessStatusCode.ShouldBeTrue(); response1.Institutions.Length.ShouldBe(limit); response2.Institutions.Length.ShouldBe(1); page.ShouldNotContain(nextItem); }
public async void GetByIdTest() { const string clientId = "5e4c1c52b83f3800124fc525"; const string clientSecret = "93c8b61ef98301c4bac73677b8be73"; const string publicKey = "ef0d740aef5ab5b25d094ad150ed05"; var client = new PlaidClient(Environment.Sandbox); var institutionRequest = new GetRequest() { Count = 1, Offset = 0, ClientId = clientId, Secret = clientSecret }; var institutionResults = await client.FetchAllInstitutionsAsync(institutionRequest); Assert.Null(institutionResults.Exception); Assert.True(institutionResults.IsSuccessStatusCode); Assert.True(institutionResults.Institutions.Length == 1); var idRequest = new SearchByIdRequest() { PublicKey = publicKey, InstitutionId = institutionResults.Institutions.FirstOrDefault()?.Id }; var idResults = await client.FetchInstitutionByIdAsync(idRequest); Assert.Null(idResults.Exception); Assert.True(idResults.IsSuccessStatusCode); Assert.NotNull(idResults.Institution); }
public async void GetTest() { const string clientId = "5e4c1c52b83f3800124fc525"; const string clientSecret = "93c8b61ef98301c4bac73677b8be73"; const string publicKey = "ef0d740aef5ab5b25d094ad150ed05"; var client = new PlaidClient(Environment.Sandbox); var institutionRequest = new GetRequest() { Count = 10, Offset = 0, ClientId = clientId, Secret = clientSecret }; var institutionResults = await client.FetchAllInstitutionsAsync(institutionRequest); Assert.Null(institutionResults.Exception); Assert.True(institutionResults.Institutions.Length == 10); }
public void FetchAllInstitutionsAsync_should_retrieve_a_list_of_all_banks() { // Arrange var sut = new PlaidClient(Environment.Sandbox); // Act var request = new Institution.GetAllRequest() { Options = new Institution.GetOptions { IncludeOptionalMetadata = true } }.UseDefaults(); var institutions = sut.FetchAllInstitutionsAsync(request).Result; // Assert institutions.Length.ShouldBeGreaterThan(500); institutions.Where(i => i.Logo != null).ShouldNotBeEmpty(); foreach (var i in institutions) { i.Url.ShouldNotBeNullOrEmpty(); } }