/// <summary> /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.PartialViewResult"/> /// 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 PartialView <TActionResult, TModel>( this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder, TModel model) => shouldReturnTestBuilder .PartialView(partialView => partialView .WithName(null) .WithModel(model));
/// <summary> /// Tests whether the action result is <see cref="PartialViewResult"/> with the provided partial 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 partial view name.</param> /// <param name="model">Expected model object.</param> /// <returns>Test builder of <see cref="IViewTestBuilder"/> type.</returns> public static IViewTestBuilder PartialView <TActionResult, TModel>( this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder, string viewName, TModel model) { var viewTestBuilder = shouldReturnTestBuilder.PartialView(viewName); viewTestBuilder.WithModel(model); return(viewTestBuilder); }
/// <summary> /// Tests whether the action result is <see cref="PartialViewResult"/> 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 PartialView <TActionResult, TModel>( this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder, TModel model) { return(shouldReturnTestBuilder.PartialView(null, model)); }
/// <summary> /// Tests whether the action result is <see cref="PartialViewResult"/> with the default view name. /// </summary> /// <typeparam name="TActionResult">Type of action result type.</typeparam> /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param> /// <returns>Test builder of <see cref="IViewTestBuilder"/> type.</returns> public static IViewTestBuilder PartialView <TActionResult>(this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder) { return(shouldReturnTestBuilder.PartialView(null)); }
/// <summary> /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.PartialViewResult"/> /// 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 PartialView <TActionResult>( this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder, string viewName) => shouldReturnTestBuilder .PartialView(partialView => partialView .WithName(viewName));
/// <summary> /// Tests whether the action result is <see cref="PartialViewResult"/>. /// </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 PartialView <TActionResult>( this IShouldReturnTestBuilder <TActionResult> builder) => builder .PartialView(partialView => partialView .WithDefaultName());