/// <summary>
 /// Tests whether <see cref="Microsoft.AspNetCore.Mvc.LocalRedirectResult"/> redirects to specific asynchronous action.
 /// </summary>
 /// <typeparam name="TController">Type of expected redirect controller.</typeparam>
 /// <param name="builder">Instance of <see cref="ILocalRedirectTestBuilder"/> type.</param>
 /// <param name="actionCall">Method call expression indicating the expected asynchronous action.</param>
 /// <returns>The same <see cref="IAndLocalRedirectTestBuilder"/>.</returns>
 public static IAndLocalRedirectTestBuilder To <TController>(
     this ILocalRedirectTestBuilder builder,
     Expression <Func <TController, Task> > actionCall)
     where TController : class
 {
     return(ProcessRouteLambdaExpression <TController>(builder, actionCall));
 }
        private static IAndLocalRedirectTestBuilder ProcessRouteLambdaExpression(
            ILocalRedirectTestBuilder builder,
            LambdaExpression actionCall)
        {
            var actualBuilder = (LocalRedirectTestBuilder)builder;

            ExpressionLinkValidator.Validate(
                actualBuilder.TestContext,
                LinkGenerationTestContext.FromLocalRedirectResult(actualBuilder.ActionResult),
                actionCall,
                actualBuilder.ThrowNewFailedValidationException);

            return(actualBuilder);
        }
 /// <summary>
 /// Tests whether <see cref="Microsoft.AspNetCore.Mvc.LocalRedirectResult"/> redirects to specific action.
 /// </summary>
 /// <typeparam name="TController">Type of expected redirect controller.</typeparam>
 /// <param name="builder">Instance of <see cref="ILocalRedirectTestBuilder"/> type.</param>
 /// <param name="actionCall">Method call expression indicating the expected redirect action.</param>
 /// <returns>The same <see cref="IAndLocalRedirectTestBuilder"/>.</returns>
 public static IAndLocalRedirectTestBuilder To <TController>(
     this ILocalRedirectTestBuilder builder,
     Expression <Action <TController> > actionCall)
     where TController : class
 => ProcessRouteLambdaExpression(builder, actionCall);
 /// <summary>
 /// Tests whether the <see cref="LocalRedirectResult"/>
 /// has the same <see cref="IUrlHelper"/> type as the provided one.
 /// </summary>
 /// <param name="localRedirectTestBuilder">
 /// Instance of <see cref="ILocalRedirectTestBuilder"/> type.
 /// </param>
 /// <returns>The same <see cref="IAndLocalRedirectTestBuilder"/>.</returns>
 public static IAndLocalRedirectTestBuilder WithUrlHelperOfType <TUrlHelper>(
     this ILocalRedirectTestBuilder localRedirectTestBuilder)
     where TUrlHelper : IUrlHelper
 => localRedirectTestBuilder
 .WithUrlHelperOfType <IAndLocalRedirectTestBuilder, TUrlHelper>();