aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-03-11 23:21:37 +0800
committercrupest <crupest@outlook.com>2020-03-11 23:21:37 +0800
commitd089ad8774e5a6fbe0cd138e84c2a4af1e6a29af (patch)
tree52647ce84d276ffc99447cea2f78bea050ece8a5
parent5a90de954ee2d975cd038438495dfaa5a8d9d6d7 (diff)
downloadtimeline-d089ad8774e5a6fbe0cd138e84c2a4af1e6a29af.tar.gz
timeline-d089ad8774e5a6fbe0cd138e84c2a4af1e6a29af.tar.bz2
timeline-d089ad8774e5a6fbe0cd138e84c2a4af1e6a29af.zip
Add links test for timeline.
-rw-r--r--Timeline.Tests/IntegratedTests/TimelineTest.cs36
-rw-r--r--Timeline/Helpers/StringLocalizerFactoryExtensions.cs19
2 files changed, 28 insertions, 27 deletions
diff --git a/Timeline.Tests/IntegratedTests/TimelineTest.cs b/Timeline.Tests/IntegratedTests/TimelineTest.cs
index 69a04003..215dcf17 100644
--- a/Timeline.Tests/IntegratedTests/TimelineTest.cs
+++ b/Timeline.Tests/IntegratedTests/TimelineTest.cs
@@ -98,16 +98,36 @@ namespace Timeline.Tests.IntegratedTests
}
[Fact]
- public async Task Personal_TimelineGet_Should_Work()
+ public async Task TimelineGet_Should_Work()
{
using var client = await CreateDefaultClient();
- var res = await client.GetAsync("timelines/@user1");
- var body = res.Should().HaveStatusCode(200)
- .And.HaveJsonBody<TimelineInfo>().Which;
- body.Owner.Should().BeEquivalentTo(UserInfos[1]);
- body.Visibility.Should().Be(TimelineVisibility.Register);
- body.Description.Should().Be("");
- body.Members.Should().NotBeNull().And.BeEmpty();
+ {
+ var res = await client.GetAsync("timelines/@user1");
+ var body = res.Should().HaveStatusCode(200)
+ .And.HaveJsonBody<TimelineInfo>().Which;
+ body.Owner.Should().BeEquivalentTo(UserInfos[1]);
+ body.Visibility.Should().Be(TimelineVisibility.Register);
+ body.Description.Should().Be("");
+ body.Members.Should().NotBeNull().And.BeEmpty();
+ var links = body._links;
+ links.Should().NotBeNull();
+ links.Self.Should().EndWith("/timelines/@user1");
+ links.Posts.Should().EndWith("/timelines/@user1/posts");
+ }
+
+ {
+ var res = await client.GetAsync("timelines/t1");
+ var body = res.Should().HaveStatusCode(200)
+ .And.HaveJsonBody<TimelineInfo>().Which;
+ body.Owner.Should().BeEquivalentTo(UserInfos[1]);
+ body.Visibility.Should().Be(TimelineVisibility.Register);
+ body.Description.Should().Be("");
+ body.Members.Should().NotBeNull().And.BeEmpty();
+ var links = body._links;
+ links.Should().NotBeNull();
+ links.Self.Should().EndWith("/timelines/t1");
+ links.Posts.Should().EndWith("/timelines/t1/posts");
+ }
}
[Fact]
diff --git a/Timeline/Helpers/StringLocalizerFactoryExtensions.cs b/Timeline/Helpers/StringLocalizerFactoryExtensions.cs
deleted file mode 100644
index c2252b2c..00000000
--- a/Timeline/Helpers/StringLocalizerFactoryExtensions.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-
-using Microsoft.Extensions.Localization;
-using System.Reflection;
-
-namespace Timeline.Helpers
-{
- internal static class StringLocalizerFactoryExtensions
- {
- internal static IStringLocalizer Create(this IStringLocalizerFactory factory, string basename)
- {
- return factory.Create(basename, new AssemblyName(typeof(StringLocalizerFactoryExtensions).Assembly.FullName!).Name);
- }
-
- internal static StringLocalizer<T> Create<T>(this IStringLocalizerFactory factory)
- {
- return new StringLocalizer<T>(factory);
- }
- }
-} \ No newline at end of file