aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Helpers/InvalidModelTestHelpers.cs
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-08-11 16:12:23 +0800
committerGitHub <noreply@github.com>2019-08-11 16:12:23 +0800
commit285fe070388e48d82f008c3de5b0d7675f55ebfa (patch)
tree3e4e7de38b9f0e5832923a6bc1ce7872fc4370a5 /Timeline.Tests/Helpers/InvalidModelTestHelpers.cs
parent38ff45fcc0b58a95ad52ba43a8be4ff466694269 (diff)
parent4b0d4ba4e79c1a2e22ccf131d1abdbf113d78b6a (diff)
downloadtimeline-285fe070388e48d82f008c3de5b0d7675f55ebfa.tar.gz
timeline-285fe070388e48d82f008c3de5b0d7675f55ebfa.tar.bz2
timeline-285fe070388e48d82f008c3de5b0d7675f55ebfa.zip
Merge pull request #39 from crupest/fluent-assertion
Use FluentAssertions.
Diffstat (limited to 'Timeline.Tests/Helpers/InvalidModelTestHelpers.cs')
-rw-r--r--Timeline.Tests/Helpers/InvalidModelTestHelpers.cs12
1 files changed, 4 insertions, 8 deletions
diff --git a/Timeline.Tests/Helpers/InvalidModelTestHelpers.cs b/Timeline.Tests/Helpers/InvalidModelTestHelpers.cs
index 1c079d0e..af432095 100644
--- a/Timeline.Tests/Helpers/InvalidModelTestHelpers.cs
+++ b/Timeline.Tests/Helpers/InvalidModelTestHelpers.cs
@@ -1,8 +1,6 @@
-using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Timeline.Models.Http;
-using Xunit;
namespace Timeline.Tests.Helpers
{
@@ -11,17 +9,15 @@ namespace Timeline.Tests.Helpers
public static async Task TestPostInvalidModel<T>(HttpClient client, string url, T body)
{
var response = await client.PostAsJsonAsync(url, body);
- Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
- var responseBody = await response.ReadBodyAsJson<CommonResponse>();
- Assert.Equal(CommonResponse.ErrorCodes.InvalidModel, responseBody.Code);
+ response.Should().HaveStatusCodeBadRequest()
+ .And.Should().HaveBodyAsCommonResponseWithCode(CommonResponse.ErrorCodes.InvalidModel);
}
public static async Task TestPutInvalidModel<T>(HttpClient client, string url, T body)
{
var response = await client.PutAsJsonAsync(url, body);
- Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
- var responseBody = await response.ReadBodyAsJson<CommonResponse>();
- Assert.Equal(CommonResponse.ErrorCodes.InvalidModel, responseBody.Code);
+ response.Should().HaveStatusCodeBadRequest()
+ .And.Should().HaveBodyAsCommonResponseWithCode(CommonResponse.ErrorCodes.InvalidModel);
}
}
}