Example #1
0
        public static ActionResult AssertHttpStatusReturned(this ActionResult actionResult, int status)
        {
            actionResult.AssertHttpStatusReturned();

            var castedActionResult = actionResult as HttpStatusCodeResult;

            if (castedActionResult.StatusCode != status)
            {
                throw new ActionResultAssertionException(string.Format("Expected HTTP status code to be {0}, but instead received a {1}.", status, castedActionResult.StatusCode));
            }

            return(actionResult);
        }