File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Testing/Acceptance/Modules/Controllers Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ using System . Net ;
2+ using GenHTTP . Api . Protocol ;
3+ using GenHTTP . Modules . Controllers ;
4+ using GenHTTP . Modules . Layouting ;
5+ using GenHTTP . Testing . Acceptance . Utilities ;
6+ using Microsoft . VisualStudio . TestTools . UnitTesting ;
7+
8+ namespace GenHTTP . Testing . Acceptance . Modules . Controllers ;
9+
10+ [ TestClass ]
11+ public class IntegrationTests
12+ {
13+
14+ #region Supporting data structures
15+
16+ public class TestController
17+ {
18+
19+ [ ControllerAction ( RequestMethod . Get ) ]
20+ public string DoWork ( ) => "Work done" ;
21+
22+ }
23+
24+ #endregion
25+
26+ [ TestMethod ]
27+ [ MultiEngineTest ]
28+ public async Task TestInstance ( TestEngine engine )
29+ {
30+ var app = Layout . Create ( )
31+ . Add ( Controller . From ( new TestController ( ) ) ) ;
32+
33+ await using var host = await TestHost . RunAsync ( app , engine : engine ) ;
34+
35+ using var response = await host . GetResponseAsync ( "/do-work/" ) ;
36+
37+ await response . AssertStatusAsync ( HttpStatusCode . OK ) ;
38+
39+ Assert . AreEqual ( "Work done" , await response . GetContentAsync ( ) ) ;
40+ }
41+
42+ [ TestMethod ]
43+ public void TestChaining ( )
44+ {
45+ Chain . Works ( Controller . From < TestController > ( ) ) ;
46+ }
47+
48+ }
You can’t perform that action at this time.
0 commit comments