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); }
public void TestBadRequestFilter() { var notFoundFilter = new DomainValidationFilter(); var exceptionContext = new FakeContext(); exceptionContext.Exception = new DomainValidationException(new List <DomainError> { new TestError("egal") }); notFoundFilter.OnException(exceptionContext); var exceptionContextResult = exceptionContext.Result as BadRequestObjectResult; Assert.IsNotNull(exceptionContextResult); Assert.AreEqual(400, exceptionContextResult.StatusCode); }