public void AddClaimAsync_IdentityAdminThrows_ReturnsErrors() { IdentityAdminImpl.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() { IdentityAdminImpl.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"); }