Ejemplo n.º 1
0
        public void GiveARequestWithNoPreferHeader_WhenGettingAnExportOperationRequest_ThenAResourceNotValidExceptionShouldBeThrown()
        {
            var filter  = new ValidateExportHeadersFilterAttribute();
            var context = CreateContext();

            context.HttpContext.Request.Headers.Add(HeaderNames.Accept, CorrectAcceptHeaderValue);

            Assert.Throws <RequestNotValidException>(() => filter.OnActionExecuting(context));
        }
Ejemplo n.º 2
0
        public void GiveARequestWithValidAcceptAndPreferHeader_WhenGettingAnExportOperationRequest_ThenTheResultIsSuccessful()
        {
            var filter  = new ValidateExportHeadersFilterAttribute();
            var context = CreateContext();

            context.HttpContext.Request.Headers.Add(HeaderNames.Accept, CorrectAcceptHeaderValue);
            context.HttpContext.Request.Headers.Add(PreferHeaderName, CorrectPreferHeaderValue);

            filter.OnActionExecuting(context);
        }