Example #1
0
        public void GetClientsAsync_IdentityAdminThrows_ReturnsErrors()
        {
            ClientServiceImpl.SetupQueryClientsAsync(new Exception("Boom"));
            var response = Get("api/Clients");

            Assert.AreEqual(HttpStatusCode.InternalServerError, response.StatusCode);
        }
Example #2
0
        public void GetClientsAsync_IdentityAdminFails_ReturnsErrors()
        {
            ClientServiceImpl.SetupQueryClientsAsync("foo", "bar", "baz");

            var response = Get("api/Clients");

            Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode);

            var error = response.Content.ReadAsAsync <ErrorModel>().Result;

            Assert.AreEqual(3, error.Errors.Length);
            CollectionAssert.Contains(error.Errors, "foo");
            CollectionAssert.Contains(error.Errors, "bar");
            CollectionAssert.Contains(error.Errors, "baz");
        }