Skip to content

Commit 426947a

Browse files
committed
Merge pull request #155 from ivaylokenov/route-test-builder
Route test builder
2 parents 3288666 + fb72aaa commit 426947a

File tree

57 files changed

+4697
-90
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+4697
-90
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,28 @@ namespace MyApp.Tests.Controllers
4646
```
4747

4848
The example uses NUnit but you can use whatever testing framework you want.
49+
Basically, the framework throws an unhandled exception if the assertion does not pass and the test fails.
4950

5051
Here are some random examples of what the fluent testing API is capable of:
5152

5253
```c#
54+
// tests a route for correct controller, action and resolved route values
55+
MyWebApi
56+
.Routes()
57+
.ShouldMap("api/WebApiController/SomeAction/5")
58+
.WithJsonContent(@"{""SomeInt"": 1, ""SomeString"": ""Test""}")
59+
.And()
60+
.WithHttpMethod(HttpMethod.Post)
61+
.To<WebApiController>(c => c.SomeAction(5, new RequestModel
62+
{
63+
SomeInt = 1,
64+
SomeString = "Test"
65+
}))
66+
.AndAlso()
67+
.ToNoHandler()
68+
.AndAlso()
69+
.ToValidModelState();
70+
5371
// injects dependencies into controller
5472
// and mocks authenticated user
5573
// and tests for valid model state

0 commit comments

Comments
 (0)