Skip to content

Commit e75993a

Browse files
committed
Added AggregateException testing to the README.md (closes #73)
1 parent 5f8735a commit e75993a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

documentation/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,32 @@ MyWebApi
371371
.AndAlso() // AndAlso() is not necessary
372372
.WithMessage("Some exception message");
373373

374+
// tests whether the action throws AggregateException
375+
MyWebApi
376+
.Controller<WebApiController>()
377+
.Calling(c => c.SomeAction())
378+
.ShouldThrow()
379+
.AggregateException();
380+
381+
// tests whether the action throws AggregateException
382+
// with specific total number of inner exceptions
383+
MyWebApi
384+
.Controller<WebApiController>()
385+
.Calling(c => c.SomeAction())
386+
.ShouldThrow()
387+
.AggregateException(withNumberOfInnerExceptions: 2);
388+
389+
// tests whether the action throws AggregateException
390+
// containing specific inner exceptions
391+
MyWebApi
392+
.Controller<WebApiController>()
393+
.Calling(c => c.SomeAction())
394+
.ShouldThrow()
395+
.AggregateException()
396+
.ContainingInnerExceptionOfType<NullReferenceException>()
397+
.AndAlso() // AndAlso is not necessary
398+
.ContainingInnerExceptionOfType<InvalidOperationException>();
399+
374400
// tests whether the action throws HttpResponseException
375401
MyWebApi
376402
.Controller<WebApiController>()

0 commit comments

Comments
 (0)