diff options
author | crupest <crupest@outlook.com> | 2020-01-31 21:57:09 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-01-31 21:57:09 +0800 |
commit | 3749a642306b19c84f324b0e94c4d62d8ec60332 (patch) | |
tree | 9039ebf7eb7a21d2e57bbe928e43bf39a42473b1 /Timeline.Tests | |
parent | a7fd42ddee50a8066a083c57b7940e4f9896dcb7 (diff) | |
download | timeline-3749a642306b19c84f324b0e94c4d62d8ec60332.tar.gz timeline-3749a642306b19c84f324b0e94c4d62d8ec60332.tar.bz2 timeline-3749a642306b19c84f324b0e94c4d62d8ec60332.zip |
Fix test bugs in user info mapper. Make create user action return created user info.
Diffstat (limited to 'Timeline.Tests')
-rw-r--r-- | Timeline.Tests/IntegratedTests/IntegratedTestBase.cs | 3 | ||||
-rw-r--r-- | Timeline.Tests/IntegratedTests/UserTest.cs | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/Timeline.Tests/IntegratedTests/IntegratedTestBase.cs b/Timeline.Tests/IntegratedTests/IntegratedTestBase.cs index 59af5eab..dfde2ea5 100644 --- a/Timeline.Tests/IntegratedTests/IntegratedTestBase.cs +++ b/Timeline.Tests/IntegratedTests/IntegratedTestBase.cs @@ -12,13 +12,12 @@ using Xunit; namespace Timeline.Tests.IntegratedTests { - public abstract class IntegratedTestBase : IClassFixture<WebApplicationFactory<Startup>>, IDisposable { static IntegratedTestBase()
{
FluentAssertions.AssertionOptions.AssertEquivalencyUsing(options =>
- options.Excluding(m => m.RuntimeType == typeof(UserInfo) && m.SelectedMemberPath == "_links"));
+ options.Excluding(m => m.RuntimeType == typeof(UserInfoLinks)));
} protected TestApplication TestApp { get; } diff --git a/Timeline.Tests/IntegratedTests/UserTest.cs b/Timeline.Tests/IntegratedTests/UserTest.cs index bbeb6ad6..f863eb6c 100644 --- a/Timeline.Tests/IntegratedTests/UserTest.cs +++ b/Timeline.Tests/IntegratedTests/UserTest.cs @@ -296,7 +296,11 @@ namespace Timeline.Tests.IntegratedTests Administrator = true,
Nickname = "ccc"
});
- res.Should().HaveStatusCode(200);
+ var body = res.Should().HaveStatusCode(200)
+ .And.HaveJsonBody<UserInfo>().Which;
+ body.Username.Should().Be("aaa");
+ body.Nickname.Should().Be("ccc");
+ body.Administrator.Should().BeTrue();
}
{
var res = await client.GetAsync("users/aaa");
|