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
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:
@@ -42,6 +61,8 @@ MyWebApi
42
61
.Controller(myWebApiControllerInstance);
43
62
```
44
63
64
+
[To top](#table-of-contents)
65
+
45
66
### Authenticated user
46
67
47
68
```c#
@@ -68,6 +89,8 @@ MyWebApi
68
89
.InRoles("Moderator", "Administrator")); // or InRole("Moderator")
69
90
```
70
91
92
+
[To top](#table-of-contents)
93
+
71
94
### Calling actions
72
95
73
96
You can call any action using lambda expression. All parameter values will be resolved and model state validation will be performed on them:
@@ -89,6 +112,8 @@ MyWebApi
89
112
.CallingAsync(c=>c.SomeActionAsync());
90
113
```
91
114
115
+
[To top](#table-of-contents)
116
+
92
117
### Model state validation
93
118
94
119
You can test whether model state is valid/invalid or contains any specific error:
0 commit comments