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
commit70af7808deca84ad2d118c5002989a98e1623450 (patch)
tree52647ce84d276ffc99447cea2f78bea050ece8a5
parent61a4a86c3c428cc7ca985f003fb23641d1bde2ee (diff)
downloadtimeline-70af7808deca84ad2d118c5002989a98e1623450.tar.gz
timeline-70af7808deca84ad2d118c5002989a98e1623450.tar.bz2
timeline-70af7808deca84ad2d118c5002989a98e1623450.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