File tree Expand file tree Collapse file tree
Modules/Websockets/Handler
Testing/Acceptance/Modules/Websockets Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public static void Schedule(Func<Task> work)
2929 }
3030 catch ( Exception e )
3131 {
32- FleckLog . Error ( "Failed to run asynchronous event handler" , e ) ;
32+ FleckLog . Error ( "Failed to run asynchronous event handler. " , e ) ;
3333 }
3434 } ) ;
3535 }
Original file line number Diff line number Diff line change 11using System . Net ;
2- using Microsoft . VisualStudio . TestTools . UnitTesting ;
2+
3+ using Websocket . Client ;
34
45using WS = GenHTTP . Modules . Websockets . Websocket ;
56
@@ -19,4 +20,19 @@ public async Task TestInvalidRequest()
1920 Assert . AreEqual ( HttpStatusCode . BadRequest , response . StatusCode ) ;
2021 }
2122
23+ [ TestMethod ]
24+ public async Task TestErrorHandling ( )
25+ {
26+ var server = WS . Create ( )
27+ . OnOpen ( _ => throw new InvalidOperationException ( "Ooops" ) ) ;
28+
29+ await using var host = await TestHost . RunAsync ( server ) ;
30+
31+ using var client = new WebsocketClient ( new Uri ( "ws://localhost:" + host . Port ) ) ;
32+
33+ await client . Start ( ) ;
34+
35+ await Task . Delay ( 1000 ) ;
36+ }
37+
2238}
Original file line number Diff line number Diff line change 11using GenHTTP . Testing . Acceptance . Utilities ;
2+
23using WS = GenHTTP . Modules . Websockets ;
3- using Microsoft . VisualStudio . TestTools . UnitTesting ;
4+
45using Websocket . Client ;
56
67namespace GenHTTP . Testing . Acceptance . Modules . Websockets ;
You can’t perform that action at this time.
0 commit comments