public void GivenARequestWithNoSetTransferSyntaxHeader_WhenValidatingTheTransferSyntaxAgainstTransferSyntaxFilterWhichAllowMissing_ThenFilterShouldPass() { _filter = CreateFilter(new[] { DefaultTransferSyntax }, allowMissing: true); _filter.OnActionExecuting(_context); Assert.Null((_context.Result as StatusCodeResult)?.StatusCode); }
public void GivenARequestWithNoSetTransferSyntaxHeader_WhenValidatingTheTransferSyntaxAgainstTransferSyntaxFilter_ThenNotAcceptableStatusCodeShouldBeReturned() { _filter = CreateFilter(new[] { DefaultTransferSyntax }); _filter.OnActionExecuting(_context); Assert.Equal((int)HttpStatusCode.NotAcceptable, (_context.Result as StatusCodeResult)?.StatusCode); }
public void GivenARequestWithSupportedTransferSyntax_WhenValidatingTheTransferSyntaxAgainstTransferSyntaxFilter_ThenFilterShouldPass(string parsedTransferSyntax) { _filter = CreateFilter(new[] { DefaultTransferSyntax }); _context.ModelState.SetModelValue(TransferSyntaxHeaderPrefix, new ValueProviderResult(parsedTransferSyntax)); _filter.OnActionExecuting(_context); Assert.Null((_context.Result as StatusCodeResult)?.StatusCode); }
public void GivenARequestWithUnsupportedTransferSyntax_WhenValidatingTheTransferSyntaxAgainstTransferSyntaxFilter_ThenCorrectStatusCodeShouldBeReturned(string parsedTransferSyntax) { _filter = CreateFilter(new[] { DefaultTransferSyntax }); _context.ModelState.SetModelValue(TransferSyntaxHeaderPrefix, new ValueProviderResult(parsedTransferSyntax)); _filter.OnActionExecuting(_context); Assert.Equal((int)HttpStatusCode.NotAcceptable, (_context.Result as StatusCodeResult)?.StatusCode); }