Skip to content

Commit 32cc201

Browse files
committed
Added test for IAndTestBuilder (#13)
1 parent 9eed6e0 commit 32cc201

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

MyWebApi.Tests/BuildersTests/ActionsTests/ShouldHaveModelStateTests.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,31 @@ public void ShouldHaveInvalidModelStateShouldThrowExceptionWithValidRequestModel
7373
.Calling(c => c.ModelStateCheck(requestModel))
7474
.ShouldHaveInvalidModelState();
7575
}
76+
77+
[Test]
78+
public void AndShouldWorkCorrectlyWithValidModelState()
79+
{
80+
var requestModel = TestObjectFactory.GetValidRequestModel();
81+
82+
MyWebApi
83+
.Controller<WebApiController>()
84+
.Calling(c => c.ModelStateCheck(requestModel))
85+
.ShouldHaveValidModelState()
86+
.And()
87+
.ShouldReturnOk();
88+
}
89+
90+
[Test]
91+
public void AndShouldWorkCorrectlyWithInvalidModelState()
92+
{
93+
var requestModelWithErrors = TestObjectFactory.GetRequestModelWithErrors();
94+
95+
MyWebApi
96+
.Controller<WebApiController>()
97+
.Calling(c => c.ModelStateCheck(requestModelWithErrors))
98+
.ShouldHaveInvalidModelState()
99+
.And()
100+
.ShouldReturnOk();
101+
}
76102
}
77103
}

0 commit comments

Comments
 (0)