diff options
author | 杨宇千 <crupest@outlook.com> | 2019-08-11 15:34:59 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-08-11 15:34:59 +0800 |
commit | 26392cdd2028eff2132948d5cc5e36e08a2d69a9 (patch) | |
tree | 233518dd41d7747c8932eac67d48a62aa4203d53 /Timeline.Tests/AuthorizationUnitTest.cs | |
parent | 38ff45fcc0b58a95ad52ba43a8be4ff466694269 (diff) | |
download | timeline-26392cdd2028eff2132948d5cc5e36e08a2d69a9.tar.gz timeline-26392cdd2028eff2132948d5cc5e36e08a2d69a9.tar.bz2 timeline-26392cdd2028eff2132948d5cc5e36e08a2d69a9.zip |
Add FluentAssertions.
Diffstat (limited to 'Timeline.Tests/AuthorizationUnitTest.cs')
-rw-r--r-- | Timeline.Tests/AuthorizationUnitTest.cs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Timeline.Tests/AuthorizationUnitTest.cs b/Timeline.Tests/AuthorizationUnitTest.cs index d9fb7406..3df4d0fd 100644 --- a/Timeline.Tests/AuthorizationUnitTest.cs +++ b/Timeline.Tests/AuthorizationUnitTest.cs @@ -5,6 +5,7 @@ using Timeline.Tests.Helpers; using Timeline.Tests.Helpers.Authentication;
using Xunit;
using Xunit.Abstractions;
+using FluentAssertions;
namespace Timeline.Tests
{
@@ -27,7 +28,7 @@ namespace Timeline.Tests using (var client = _factory.CreateDefaultClient())
{
var response = await client.GetAsync(AuthorizeUrl);
- Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
+ response.Should().HaveStatusCode(HttpStatusCode.Unauthorized);
}
}
@@ -37,7 +38,7 @@ namespace Timeline.Tests using (var client = await _factory.CreateClientAsUser())
{
var response = await client.GetAsync(AuthorizeUrl);
- Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ response.Should().HaveStatusCode(HttpStatusCode.OK);
}
}
@@ -47,9 +48,9 @@ namespace Timeline.Tests using (var client = await _factory.CreateClientAsUser())
{
var response1 = await client.GetAsync(UserUrl);
- Assert.Equal(HttpStatusCode.OK, response1.StatusCode);
+ response1.Should().HaveStatusCode(HttpStatusCode.OK);
var response2 = await client.GetAsync(AdminUrl);
- Assert.Equal(HttpStatusCode.Forbidden, response2.StatusCode);
+ response2.Should().HaveStatusCode(HttpStatusCode.Forbidden);
}
}
@@ -59,9 +60,9 @@ namespace Timeline.Tests using (var client = await _factory.CreateClientAsAdmin())
{
var response1 = await client.GetAsync(UserUrl);
- Assert.Equal(HttpStatusCode.OK, response1.StatusCode);
+ response1.Should().HaveStatusCode(HttpStatusCode.OK);
var response2 = await client.GetAsync(AdminUrl);
- Assert.Equal(HttpStatusCode.OK, response2.StatusCode);
+ response2.Should().HaveStatusCode(HttpStatusCode.OK);
}
}
}
|