Skip to content

Commit 9708bd8

Browse files
committed
Merge pull request #78 from ivaylokenov/json-test-builder
Json test builder
2 parents 3985383 + 4ff528d commit 9708bd8

File tree

107 files changed

+4375
-776
lines changed

Some content is hidden

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

107 files changed

+4375
-776
lines changed

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ namespace MyApp.Tests.Controllers
3838
MyWebApi
3939
.Controller<HomeController>()
4040
.Calling(c => c.Get())
41-
.ShouldReturnOk();
41+
.ShouldReturn()
42+
.Ok();
4243
}
4344
}
4445
}
@@ -52,16 +53,18 @@ Here are some random examples of what the fluent testing API is capable of:
5253
// injects dependencies into controller
5354
// and mocks authenticated user
5455
// and tests for valid model state
55-
// and tests response model from Ok result with certain assertions
56+
// and tests response model from Ok result with specific assertions
5657
MyWebApi
5758
.Controller<WebApiController>()
5859
.WithResolvedDependencyFor<IInjectedService>(mockedInjectedService)
5960
.WithResolvedDependencyFor<IAnotherInjectedService>(anotherMockedInjectedService);
6061
.WithAuthenticatedUser(user => user.WithUsername("NewUserName"))
6162
.Calling(c => c.SomeAction(requestModel))
62-
.ShouldHaveValidModelState()
63+
.ShouldHave()
64+
.ValidModelState()
6365
.AndAlso()
64-
.ShouldReturnOk()
66+
.ShouldReturn()
67+
.Ok()
6568
.WithResponseModelOfType<ResponseModel>()
6669
.Passing(m =>
6770
{
@@ -74,7 +77,8 @@ MyWebApi
7477
MyWebApi
7578
.Controller<WebApiController>()
7679
.Calling(c => c.SomeAction(requestModel))
77-
.ShouldHaveModelStateFor<RequestModel>()
80+
.ShouldHave()
81+
.ModelStateFor<RequestModel>()
7882
.ContainingModelStateErrorFor(m => m.SomeProperty).ThatEquals("Error message")
7983
.AndAlso()
8084
.ContainingModelStateErrorFor(m => m.SecondProperty).BeginningWith("Error")
@@ -88,7 +92,8 @@ MyWebApi
8892
MyWebApi
8993
.Controller<WebApiController>()
9094
.Calling(c => c.SomeAction())
91-
.ShouldReturnInternalServerError()
95+
.ShouldReturn()
96+
.InternalServerError()
9297
.WithException()
9398
.OfType<SomeException>()
9499
.AndAlso()

0 commit comments

Comments
 (0)