예제 #1
0
        public async Task GetCategoryNotFound()
        {
            IHttpClientWrapper httpClient = this.GetMockHttpClient("CategoryNotFound.json", HttpStatusCode.NotFound, HttpMethod.Get, "categories/notexists");
            IPlaidClient       testClient = this.GetPlaidClient(httpClient);
            var result = await testClient.GetCategoryAsync("notexists");

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

            Assert.IsNotNull(result.Exception);
            Assert.AreEqual(404, result.Exception.HttpStatusCode);
            Assert.AreEqual(ErrorCode.CategoryNotFound, result.Exception.ErrorCode);
            Assert.IsFalse(string.IsNullOrWhiteSpace(result.Exception.Message));
            Assert.IsFalse(string.IsNullOrWhiteSpace(result.Exception.Resolution));
        }
예제 #2
0
        public async Task GetCategorySuccess()
        {
            string             categoryId = "10001000";
            IHttpClientWrapper httpClient = this.GetMockHttpClient("Category.json", HttpStatusCode.OK, HttpMethod.Get, "categories/" + categoryId);
            IPlaidClient       testClient = this.GetPlaidClient(httpClient);
            var result = await testClient.GetCategoryAsync(categoryId);

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

            Assert.AreEqual(categoryId, result.Value.Id);
            Assert.AreEqual("special", result.Value.Type);
            Assert.IsNotNull(result.Value.Hierarchy);
            Assert.IsTrue(result.Value.Hierarchy.Count > 0);
            Assert.AreEqual("Bank Fees", result.Value.Hierarchy[0]);
            Assert.AreEqual("Overdraft", result.Value.Hierarchy[1]);
        }