/// <inheritdoc />
        public IAndRedirectTestBuilder ToController(string controllerName)
        {
            var redirectAtActionResult = this.GetRedirectResult <RedirectToActionResult>("controller name");

            RouteActionResultValidator.ValidateControllerName(
                redirectAtActionResult,
                controllerName,
                this.ThrowNewRedirectResultAssertionException);

            return(this);
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public IAndCreatedTestBuilder AtController(string controllerName)
        {
            var createdAtActionResult = this.GetCreatedResult <CreatedAtActionResult>("controller name");

            RouteActionResultValidator.ValidateControllerName(
                createdAtActionResult,
                controllerName,
                this.ThrowNewCreatedResultAssertionException);

            return(this);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Tests whether the <see cref="RedirectToActionResult"/>
        /// result has specific controller name.
        /// </summary>
        /// <param name="redirectTestBuilder">
        /// Instance of <see cref="IRedirectTestBuilder"/> type.
        /// </param>
        /// <param name="controllerName">Expected controller name.</param>
        /// <returns>The same <see cref="IAndRedirectTestBuilder"/>.</returns>
        public static IAndRedirectTestBuilder ToController(
            this IRedirectTestBuilder redirectTestBuilder,
            string controllerName)
        {
            var actualBuilder = GetRedirectTestBuilder <RedirectToActionResult>(redirectTestBuilder, "controller name");

            RouteActionResultValidator.ValidateControllerName(
                actualBuilder.ActionResult,
                controllerName,
                actualBuilder.ThrowNewFailedValidationException);

            return(actualBuilder);
        }
        /// <summary>
        /// Tests whether the <see cref="AcceptedAtActionResult"/>
        /// has specific controller name.
        /// </summary>
        /// <param name="acceptedTestBuilder">
        /// Instance of <see cref="IAcceptedTestBuilder"/> type.
        /// </param>
        /// <param name="controllerName">Expected controller name.</param>
        /// <returns>The same <see cref="IAndAcceptedTestBuilder"/>.</returns>
        public static IAndAcceptedTestBuilder AtController(
            this IAcceptedTestBuilder acceptedTestBuilder,
            string controllerName)
        {
            var actualBuilder = GetAcceptedTestBuilder <AcceptedAtActionResult>(
                acceptedTestBuilder,
                "controller name");

            RouteActionResultValidator.ValidateControllerName(
                actualBuilder.ActionResult,
                controllerName,
                actualBuilder.ThrowNewFailedValidationException);

            return(actualBuilder);
        }