/// <summary>
 /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.ViewResult"/>
 /// with the same deeply equal model as the provided one.
 /// </summary>
 /// <typeparam name="TActionResult">Type of the action result.</typeparam>
 /// <typeparam name="TModel">Expected model type.</typeparam>
 /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <param name="model">Expected deeply equal model object.</param>
 /// <returns>Test builder of <see cref="IAndTestBuilder"/> type.</returns>
 public static IAndTestBuilder View <TActionResult, TModel>(
     this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
     TModel model)
 => shouldReturnTestBuilder
 .View(view => view
       .WithName(null)
       .WithModel(model));
        /// <summary>
        /// Tests whether the action result is <see cref="ViewResult"/> with the provided view name and deeply equal model object.
        /// </summary>
        /// <typeparam name="TActionResult">Type of action result type.</typeparam>
        /// <typeparam name="TModel">Expected model type.</typeparam>
        /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
        /// <param name="viewName">Expected view name.</param>
        /// <param name="model">Expected model object.</param>
        /// <returns>Test builder of <see cref="IViewTestBuilder"/> type.</returns>
        public static IViewTestBuilder View <TActionResult, TModel>(
            this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
            string viewName,
            TModel model)
        {
            var viewTestBuilder = shouldReturnTestBuilder.View(viewName);

            viewTestBuilder.WithModel(model);
            return(viewTestBuilder);
        }
예제 #3
0
 /// <summary>
 /// Tests whether the action result is <see cref="ViewResult"/> with the default view name.
 /// </summary>
 /// <typeparam name="TActionResult">Type of action result type.</typeparam>
 /// <param name="builder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <returns>Test builder of <see cref="IAndViewTestBuilder"/> type.</returns>
 public static IAndViewTestBuilder View <TActionResult>(this IShouldReturnTestBuilder <TActionResult> builder)
 {
     return(builder.View(null));
 }
 /// <summary>
 /// Tests whether the action result is <see cref="ViewResult"/> with the provided deeply equal model object.
 /// </summary>
 /// <typeparam name="TActionResult">Type of action result type.</typeparam>
 /// <typeparam name="TModel">Expected model type.</typeparam>
 /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <param name="model">Expected model object.</param>
 /// <returns>Test builder of <see cref="IViewTestBuilder"/> type.</returns>
 public static IViewTestBuilder View <TActionResult, TModel>(
     this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
     TModel model)
 {
     return(shouldReturnTestBuilder.View(null, model));
 }
 /// <summary>
 /// Tests whether the action result is <see cref="ViewResult"/> with the default view name.
 /// </summary>
 /// <typeparam name="TActionResult">Type of action result type.</typeparam>
 /// <param name="builder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <returns>Test builder of <see cref="IAndTestBuilder"/> type.</returns>
 public static IAndTestBuilder View <TActionResult>(
     this IShouldReturnTestBuilder <TActionResult> builder)
 => builder
 .View(view => view
       .WithDefaultName());
 /// <summary>
 /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.ViewResult"/>
 /// with the same view name as the provided one.
 /// </summary>
 /// <typeparam name="TActionResult">Type of the action result.</typeparam>
 /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <param name="viewName">Expected view name.</param>
 /// <returns>Test builder of <see cref="IAndTestBuilder"/> type.</returns>
 public static IAndTestBuilder View <TActionResult>(
     this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
     string viewName)
 => shouldReturnTestBuilder
 .View(view => view
       .WithName(viewName));