public void Should_return_HttpUnauthorizedResult() { // Arrange var policyResult = TestDataFactory.CreatePolicyResultFailure(); var exception = TestDataFactory.CreatePolicyViolationException(policyResult); var handler = new HttpUnauthorizedPolicyViolationHandler(); // Act var result = handler.Handle(exception).As <HttpUnauthorizedResult>(); // Assert Assert.That(result.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized)); Assert.That(result.StatusDescription, Is.EqualTo(exception.Message)); }