예제 #1
0
 /// <summary>
 /// Tests that controller action returns a <see cref="JsonResult"/>.
 /// </summary>
 /// <param name="validate">(Optional) callback validation function.</param>
 /// <returns>The <see cref="JsonResult"/> returned from the controller action.</returns>
 public JsonResult TestJson(Action <JsonResult> validate = null)
 {
     return(TestResult <JsonResult>(result =>
     {
         _modelTester?.Test(result.Data);
         validate?.Invoke(result);
     }));
 }
 /// <summary>
 /// Tests that invocation returns a <see cref="ViewViewComponentResult"/>.
 /// </summary>
 /// <param name="validate">(Optional) callback validation function.</param>
 /// <returns>The <see cref="ViewViewComponentResult"/> returned from the invocation.</returns>
 public ViewViewComponentResult TestView(Action <ViewViewComponentResult> validate = null)
 {
     return(TestResult <ViewViewComponentResult>(result =>
     {
         AssertViewName(_expectedViewName, result.ViewName);
         _modelTester?.Test(result.ViewData?.Model);
         validate?.Invoke(result);
     }));
 }