@@ -32,8 +32,7 @@ public void ShouldPassThroughCertainScenarios(ActionExecutedContext context) {
3232
3333 [ Theory ]
3434 [ MemberData ( nameof ( GetCommonMessageExceptionScenarios ) ) ]
35- public void ShouldWriteResponseForCommonMessageExceptions ( MessageException message ,
36- Func < IActionResult , bool > comparison ) {
35+ public void ShouldWriteResponseForCommonMessageExceptions ( MessageException message , Func < IActionResult , bool > comparison ) {
3736 // arrange
3837 ActionExecutedContext context = GetActionExecutedContext ( ) ;
3938 context . Exception = message ;
@@ -77,13 +76,20 @@ public void ShouldGenerateErrorModel() {
7776
7877 public static IEnumerable < object [ ] > GetCommonMessageExceptionScenarios ( ) {
7978 yield return new object [ ] {
80- new NotFoundResponseException ( ) , ( Func < IActionResult , bool > ) ( ( result ) => result is NotFoundObjectResult )
79+ new NotFoundResponseException ( ) ,
80+ ( Func < IActionResult , bool > ) ( ( result ) =>
81+ ( ( ObjectResult ) result ) . StatusCode == StatusCodes . Status404NotFound )
8182 } ;
8283 yield return new object [ ] {
8384 new UnprocessableEntityResponseException ( ) ,
8485 ( Func < IActionResult , bool > ) ( ( result ) =>
8586 ( ( ObjectResult ) result ) . StatusCode == StatusCodes . Status422UnprocessableEntity )
8687 } ;
88+ yield return new object [ ] {
89+ new UnauthorizedResponseException ( ) ,
90+ ( Func < IActionResult , bool > ) ( ( result ) =>
91+ ( ( ObjectResult ) result ) . StatusCode == StatusCodes . Status401Unauthorized )
92+ } ;
8793 yield return new object [ ] {
8894 new ForbiddenAccessResponseException ( ) ,
8995 ( Func < IActionResult , bool > ) ( ( result ) =>
@@ -94,6 +100,27 @@ public static IEnumerable<object[]> GetCommonMessageExceptionScenarios() {
94100 ( Func < IActionResult , bool > ) ( ( result ) =>
95101 ( ( ObjectResult ) result ) . StatusCode == StatusCodes . Status412PreconditionFailed )
96102 } ;
103+
104+ yield return new object [ ] {
105+ new BadRequestResponseException ( ) ,
106+ ( Func < IActionResult , bool > ) ( ( result ) =>
107+ ( ( ObjectResult ) result ) . StatusCode == StatusCodes . Status400BadRequest )
108+ } ;
109+ yield return new object [ ] {
110+ new ValidationListException ( ) ,
111+ ( Func < IActionResult , bool > ) ( ( result ) =>
112+ ( ( ObjectResult ) result ) . StatusCode == StatusCodes . Status400BadRequest )
113+ } ;
114+ yield return new object [ ] {
115+ new InternalServerErrorResponseException ( ) ,
116+ ( Func < IActionResult , bool > ) ( ( result ) =>
117+ ( ( ObjectResult ) result ) . StatusCode == StatusCodes . Status500InternalServerError )
118+ } ;
119+ yield return new object [ ] {
120+ new ConflictResponseException ( ) ,
121+ ( Func < IActionResult , bool > ) ( ( result ) =>
122+ ( ( ObjectResult ) result ) . StatusCode == StatusCodes . Status409Conflict )
123+ } ;
97124 }
98125
99126 public static IEnumerable < object [ ] > GetPassThroughScenarios ( ) {
0 commit comments