File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 2
2
using System . Net . Http ;
3
3
using System . Net . Http . Headers ;
4
4
using System . Threading . Tasks ;
5
+ using Microsoft . AspNetCore . Http ;
5
6
using NUnit . Framework ;
6
7
7
8
namespace Dubstep . TestUtilities . Tests
@@ -341,5 +342,24 @@ public async Task WhenFirstMatchReachedMaxCount_ShouldApplySecond()
341
342
AssertOkResponse ( first , firstResponse ) ;
342
343
AssertOkResponse ( second , secondResponse ) ;
343
344
}
345
+
346
+ [ Test ]
347
+ public async Task WhenSetFallbackAction_ShouldApply ( )
348
+ {
349
+ // Arrange
350
+ _server . CurrentRuleSet
351
+ . SetDefaultAction ( async ( response ) =>
352
+ {
353
+ response . StatusCode = 500 ;
354
+ await response . WriteAsync ( "Simon says server" ) ;
355
+ } ) ;
356
+ var client = _server . CreateClient ( ) ;
357
+
358
+ // Act
359
+ var actual = await client . GetAsync ( "/" ) ;
360
+
361
+ // Assert
362
+ Assert . AreEqual ( HttpStatusCode . InternalServerError , actual . StatusCode ) ;
363
+ }
344
364
}
345
365
}
You can’t perform that action at this time.
0 commit comments