You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-1Lines changed: 22 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ MyWebApi is unit testing framework providing easy fluent interface to test the A
7
7
8
8
## How to use
9
9
10
-
### Controllers
10
+
### Controller instantiation
11
11
12
12
You have a couple of options from which you can setup the controller you want to test. The framework gives you static `MyWebApi` class from which the test builder starts.
You can call any action using lambda expression. All parameter values will be resolved and model state validation will be performed on them.
27
+
28
+
```c#
29
+
// calls action with no parameters
30
+
MyWebApi
31
+
.Controller<WebApiController>()
32
+
.Calling(c=>c.SomeAction());
33
+
34
+
// calls action with parameters
35
+
MyWebApi
36
+
.Controller<WebApiController>()
37
+
.Calling(c=>c.SomeAction(requestModel));
38
+
39
+
// calls async action
40
+
MyWebApi
41
+
.Controller<WebApiController>()
42
+
.CallingAsync(c=>c.SomeActionAsync());
43
+
```
44
+
24
45
## Any questions, comments or additions?
25
46
26
47
Leave an issue on the [issues page](https://github.com/ivaylokenov/MyWebApi/issues) or send a [pull request](https://github.com/ivaylokenov/MyWebApi/pulls).
0 commit comments