Esempio n. 1
0
        public async Task GetAuthAccountSuccess()
        {
            IHttpClientWrapper httpClient = this.GetMockHttpClient("AuthUserUsBank.json", HttpStatusCode.OK, HttpMethod.Post, "auth/get");
            IPlaidClient       testClient = this.GetPlaidClient(httpClient);

            PlaidResult <IList <Account> > result = await testClient.GetAuthAccountDataAsync(new AccessToken("test_wells"));

            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsError);
            Assert.IsNotNull(result.Value);

            Assert.AreEqual(4, result.Value.Count);

            Account account = result.Value[0];

            Assert.AreEqual("QPO8Jo8vdDHMepg41PBwckXm4KdK1yUdmXOwK", account.Id);
            Assert.AreEqual("KdDjmojBERUKx3JkDd9RuxA5EvejA4SENO4AA", account.ItemId);
            Assert.AreEqual("eJXpMzpR65FP4RYno6rzuA7OZjd9n3Hna0RYa", account.UserId);
            Assert.AreEqual(1203.42, account.AvailableBalance);
            Assert.AreEqual(1274.93, account.CurrentBalance);
            Assert.AreEqual(new InstitutionType("fake_institution"), account.InstitutionType);
            Assert.AreEqual(AccountType.Depository, account.AccountType);
            Assert.AreEqual(AccountSubType.Savings, account.AccountSubtype);
            Assert.IsNotNull(account.Metadata);
            Assert.AreEqual("Plaid Savings", account.Metadata["name"]);
            Assert.AreEqual("9606", account.Metadata["number"]);
        }
Esempio n. 2
0
        public async Task GetAuthAccountError()
        {
            IHttpClientWrapper             httpClient = this.GetMockHttpClient("BadAccessToken.json", HttpStatusCode.Unauthorized, HttpMethod.Post, "auth/get");
            IPlaidClient                   testClient = this.GetPlaidClient(httpClient);
            PlaidResult <IList <Account> > result     = await testClient.GetAuthAccountDataAsync(new AccessToken("test_bad"));

            Assert.IsNotNull(result);
            Assert.IsNull(result.Value);
            Assert.IsTrue(result.IsError);

            Assert.IsNotNull(result.Exception);
            Assert.AreEqual((int)HttpStatusCode.Unauthorized, result.Exception.HttpStatusCode);
            Assert.AreEqual(ErrorCode.BadAccessToken, result.Exception.ErrorCode);
            Assert.IsFalse(string.IsNullOrWhiteSpace(result.Exception.Message));
            Assert.IsFalse(string.IsNullOrWhiteSpace(result.Exception.Resolution));
        }