/// <inheritdoc />
        public IAndRedirectTestBuilder ContainingRouteValue <TRouteValue>(TRouteValue value)
        {
            RouteActionResultValidator.ValidateRouteValue(
                this.ActionResult,
                value,
                this.ThrowNewRedirectResultAssertionException);

            return(this);
        }
        /// <inheritdoc />
        public IAndRedirectTestBuilder ContainingRouteKey(string key)
        {
            RouteActionResultValidator.ValidateRouteValue(
                this.ActionResult,
                key,
                this.ThrowNewRedirectResultAssertionException);

            return(this);
        }
        /// <inheritdoc />
        public IAndCreatedTestBuilder ContainingRouteValue <TRouteValue>(TRouteValue value)
        {
            RouteActionResultValidator.ValidateRouteValue(
                this.TestContext.MethodResult,
                value,
                this.ThrowNewCreatedResultAssertionException);

            return(this);
        }
        /// <inheritdoc />
        public IAndCreatedTestBuilder ContainingRouteKey(string key)
        {
            RouteActionResultValidator.ValidateRouteValue(
                this.TestContext.MethodResult,
                key,
                this.ThrowNewCreatedResultAssertionException);

            return(this);
        }
Example #5
0
        /// <inheritdoc />
        public IAndCreatedTestBuilder ContainingRouteValue(string key, object value)
        {
            RouteActionResultValidator.ValidateRouteValue(
                this.ActionResult,
                key,
                value,
                this.ThrowNewCreatedResultAssertionException);

            return(this);
        }
Example #6
0
        /// <summary>
        /// Tests whether the <see cref="Microsoft.AspNetCore.Mvc.ActionResult"/>
        /// contains specific route value.
        /// </summary>
        /// <param name="baseTestBuilderWithRouteValuesResult">
        /// Instance of <see cref="IBaseTestBuilderWithRouteValuesResult{TRouteValuesResultTestBuilder}"/> type.
        /// </param>
        /// <param name="value">Expected route value.</param>
        /// <returns>The same route values <see cref="Microsoft.AspNetCore.Mvc.ActionResult"/> test builder.</returns>
        public static TRouteValuesResultTestBuilder ContainingRouteValue <TRouteValuesResultTestBuilder, TRouteValue>(
            this IBaseTestBuilderWithRouteValuesResult <TRouteValuesResultTestBuilder> baseTestBuilderWithRouteValuesResult,
            TRouteValue value)
            where TRouteValuesResultTestBuilder : IBaseTestBuilderWithActionResult
        {
            var actualBuilder = GetActualBuilder(baseTestBuilderWithRouteValuesResult);

            RouteActionResultValidator.ValidateRouteValue(
                actualBuilder.TestContext.MethodResult,
                value,
                actualBuilder.ThrowNewFailedValidationException);

            return(actualBuilder.ResultTestBuilder);
        }