public void ValidateContentNegotiatorShouldThrowExceptionIfContentValidatorIsNotCorrect() { var actionResultWithContentNegotiator = new OkNegotiatedContentResult <int>(5, MyWebApi.Controller <WebApiController>().Controller); ContentNegotiatorValidator.ValidateContentNegotiator( actionResultWithContentNegotiator, new CustomContentNegotiator(), TestObjectFactory.GetFailingValidationAction()); }
/// <summary> /// Tests whether created result has specific type of content negotiator. /// </summary> /// <param name="contentNegotiator">Expected IContentNegotiator.</param> /// <returns>The same created test builder.</returns> public IAndCreatedTestBuilder WithContentNegotiator(IContentNegotiator contentNegotiator) { ContentNegotiatorValidator.ValidateContentNegotiator( this.ActionResult, contentNegotiator, this.ThrowNewCreatedResultAssertionException); return(this); }
/// <summary> /// Tests whether ok result has specific type of content negotiator. /// </summary> /// <param name="contentNegotiator">Expected IContentNegotiator.</param> /// <returns>The same ok test builder.</returns> public IAndOkTestBuilder WithContentNegotiator(IContentNegotiator contentNegotiator) { ContentNegotiatorValidator.ValidateContentNegotiator( this.ActionResult, contentNegotiator, this.ThrowNewOkResultAssertionException); return this; }