Пример #1
0
        public void GetClientAsync_IdentityAdminThrows_ReturnsErrors()
        {
            ClientServiceImpl.SetupGetClientAsync(new Exception("Boom"));
            var response = Get("api/Clients/123");

            Assert.AreEqual(HttpStatusCode.InternalServerError, response.StatusCode);
        }
Пример #2
0
        public void GetClientAsync_ClientNotFound_ReturnsNotFound()
        {
            ClientServiceImpl.SetupGetClientAsync((ClientDetail)null);
            var resp = Get("api/Clients/123");

            Assert.AreEqual(HttpStatusCode.NotFound, resp.StatusCode);
        }
Пример #3
0
        public void GetClientAsync_IdentityAdminReturnsErrors_ReturnsErrors()
        {
            ClientServiceImpl.SetupGetClientAsync("foo", "bar");
            var response = Get("api/Clients/123");

            Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode);
            var error = response.Content.ReadAsAsync <ErrorModel>().Result;

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