コード例 #1
0
        /// <inheritdoc />
        public IAndRedirectTestBuilder WithUrlHelperOfType <TUrlHelper>()
            where TUrlHelper : IUrlHelper
        {
            RouteActionResultValidator.ValidateUrlHelperOfType <TUrlHelper>(
                this.ActionResult,
                this.ThrowNewRedirectResultAssertionException);

            return(this);
        }
コード例 #2
0
        /// <inheritdoc />
        public IAndCreatedTestBuilder WithUrlHelperOfType <TUrlHelper>()
            where TUrlHelper : IUrlHelper
        {
            RouteActionResultValidator.ValidateUrlHelperOfType <TUrlHelper>(
                this.TestContext.MethodResult,
                this.ThrowNewCreatedResultAssertionException);

            return(this);
        }
        /// <summary>
        /// Tests whether the <see cref="ActionResult"/>
        /// has the same <see cref="IUrlHelper"/> type as the provided one.
        /// </summary>
        /// <param name="baseTestBuilderWithUrlHelper">
        /// Instance of <see cref="IBaseTestBuilderWithUrlHelperResult{TUrlHelperResultTestBuilder}"/> type.
        /// </param>
        /// <returns>The same URL helper <see cref="ActionResult"/> test builder.</returns>
        public static TUrlHelperResultTestBuilder WithUrlHelperOfType <TUrlHelperResultTestBuilder, TUrlHelper>(
            this IBaseTestBuilderWithUrlHelperResult <TUrlHelperResultTestBuilder> baseTestBuilderWithUrlHelper)
            where TUrlHelper : IUrlHelper
            where TUrlHelperResultTestBuilder : IBaseTestBuilderWithActionResult
        {
            var actualBuilder = GetActualBuilder(baseTestBuilderWithUrlHelper);

            RouteActionResultValidator.ValidateUrlHelperOfType <TUrlHelper>(
                actualBuilder.TestContext.MethodResult,
                actualBuilder.ThrowNewFailedValidationException);

            return(actualBuilder.ResultTestBuilder);
        }