diff options
author | crupest <crupest@outlook.com> | 2020-11-13 17:08:20 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-11-13 17:08:20 +0800 |
commit | bd2462f2bc964839e9b64f167dfa47abb3f9afe6 (patch) | |
tree | 9aefc6cb0f10ac9e8e90d66d115849469813a08f /BackEnd/Timeline.Tests/Services/TimelineServiceTest.cs | |
parent | 379b4bafe982a8a8cd3158f0a9fa38a563dbdb57 (diff) | |
download | timeline-bd2462f2bc964839e9b64f167dfa47abb3f9afe6.tar.gz timeline-bd2462f2bc964839e9b64f167dfa47abb3f9afe6.tar.bz2 timeline-bd2462f2bc964839e9b64f167dfa47abb3f9afe6.zip |
...
Diffstat (limited to 'BackEnd/Timeline.Tests/Services/TimelineServiceTest.cs')
-rw-r--r-- | BackEnd/Timeline.Tests/Services/TimelineServiceTest.cs | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/BackEnd/Timeline.Tests/Services/TimelineServiceTest.cs b/BackEnd/Timeline.Tests/Services/TimelineServiceTest.cs index 73fdd32f..5f2c20e8 100644 --- a/BackEnd/Timeline.Tests/Services/TimelineServiceTest.cs +++ b/BackEnd/Timeline.Tests/Services/TimelineServiceTest.cs @@ -22,19 +22,15 @@ namespace Timeline.Tests.Services private readonly TestClock _clock = new TestClock();
- private DataManager _dataManager;
+ private DataManager _dataManager = default!;
- private UserPermissionService _userPermissionService;
+ private UserPermissionService _userPermissionService = default!;
- private UserService _userService;
+ private UserService _userService = default!;
- private TimelineService _timelineService;
+ private TimelineService _timelineService = default!;
- private UserDeleteService _userDeleteService;
-
- public TimelineServiceTest()
- {
- }
+ private UserDeleteService _userDeleteService = default!;
protected override void OnDatabaseCreated()
{
@@ -140,7 +136,7 @@ namespace Timeline.Tests.Services var posts = await _timelineService.GetPosts(timelineName, testPoint);
posts.Should().HaveCount(3)
- .And.Subject.Select(p => (p.Content as TextTimelinePostContent).Text).Should().Equal(postContentList.Skip(1));
+ .And.Subject.Select(p => ((TextTimelinePostContent)p.Content!).Text).Should().Equal(postContentList.Skip(1));
}
[Theory]
@@ -164,7 +160,7 @@ namespace Timeline.Tests.Services var posts = await _timelineService.GetPosts(timelineName);
posts.Should().HaveCount(4);
posts.Select(p => p.Deleted).Should().Equal(Enumerable.Repeat(false, posts.Count));
- posts.Select(p => ((TextTimelinePostContent)p.Content).Text).Should().Equal(postContentList);
+ posts.Select(p => ((TextTimelinePostContent)p.Content!).Text).Should().Equal(postContentList);
foreach (var id in new long[] { posts[0].Id, posts[2].Id })
{
@@ -174,12 +170,12 @@ namespace Timeline.Tests.Services posts = await _timelineService.GetPosts(timelineName);
posts.Should().HaveCount(2);
posts.Select(p => p.Deleted).Should().Equal(Enumerable.Repeat(false, posts.Count));
- posts.Select(p => ((TextTimelinePostContent)p.Content).Text).Should().Equal(new string[] { "b", "d" });
+ posts.Select(p => ((TextTimelinePostContent)p.Content!).Text).Should().Equal(new string[] { "b", "d" });
posts = await _timelineService.GetPosts(timelineName, includeDeleted: true);
posts.Should().HaveCount(4);
posts.Select(p => p.Deleted).Should().Equal(new bool[] { true, false, true, false });
- posts.Where(p => !p.Deleted).Select(p => ((TextTimelinePostContent)p.Content).Text).Should().Equal(new string[] { "b", "d" });
+ posts.Where(p => !p.Deleted).Select(p => ((TextTimelinePostContent)p.Content!).Text).Should().Equal(new string[] { "b", "d" });
}
[Theory]
|