public void AddClaimAsync_IdentityAdminThrows_ReturnsErrors() { ClientServiceImpl.SetupAddClaimAsync(new Exception("Boom")); var resp = Post("api/Clients/123/claim", new ClientClaimValue { Type = "color", Value = "blue" }); Assert.AreEqual(HttpStatusCode.InternalServerError, resp.StatusCode); }
public void AddClaimAsync_IdentityAdminReturnsError_ReturnsError() { ClientServiceImpl.SetupAddClaimAsync("foo", "bar"); var resp = Post("api/Clients/123/claim", new ClientClaimValue { Type = "color", Value = "blue" }); Assert.AreEqual(HttpStatusCode.BadRequest, resp.StatusCode); var error = resp.Content.ReadAsAsync <ErrorModel>().Result; Assert.AreEqual(2, error.Errors.Length); CollectionAssert.Contains(error.Errors, "foo"); CollectionAssert.Contains(error.Errors, "bar"); }