示例#1
0
        public void ValidateContentNegotiatorShouldThrowExceptionIfContentValidatorIsNotCorrect()
        {
            var actionResultWithContentNegotiator = new OkNegotiatedContentResult <int>(5, MyWebApi.Controller <WebApiController>().Controller);

            ContentNegotiatorValidator.ValidateContentNegotiator(
                actionResultWithContentNegotiator,
                new CustomContentNegotiator(),
                TestObjectFactory.GetFailingValidationAction());
        }
示例#2
0
        /// <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);
        }
示例#3
0
        /// <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;
        }