예제 #1
0
        public void TestBadRequestFilter_TypelessErrors()
        {
            var notFoundFilter   = new DomainValidationFilter();
            var exceptionContext = new FakeContext();

            exceptionContext.Exception = new DomainValidationException(new List <DomainError> {
                DomainError.Create(EnumErrors.Error1)
            });
            notFoundFilter.OnException(exceptionContext);

            var exceptionContextResult = exceptionContext.Result as BadRequestObjectResult;

            Assert.IsNotNull(exceptionContextResult);
            Assert.AreEqual(400, exceptionContextResult.StatusCode);
        }