From 41810d365ae87d93a19d78e5cb7d0187af842228 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 7 Jan 2021 21:50:37 +0800 Subject: chore: Split integrated tests to speed up tests. --- .../IntegratedTests/BaseTimelineTest.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 BackEnd/Timeline.Tests/IntegratedTests/BaseTimelineTest.cs (limited to 'BackEnd/Timeline.Tests/IntegratedTests/BaseTimelineTest.cs') diff --git a/BackEnd/Timeline.Tests/IntegratedTests/BaseTimelineTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/BaseTimelineTest.cs new file mode 100644 index 00000000..0bf3b2b2 --- /dev/null +++ b/BackEnd/Timeline.Tests/IntegratedTests/BaseTimelineTest.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Timeline.Models.Http; + +namespace Timeline.Tests.IntegratedTests +{ + public class BaseTimelineTest : IntegratedTestBase + { + public BaseTimelineTest() : base(3) + { + } + + protected override async Task OnInitializeAsync() + { + for (int i = 0; i <= 3; i++) + { + using var client = await CreateClientAs(i); + await client.TestPostAsync("timelines", new TimelineCreateRequest { Name = $"t{i}" }); + } + } + + public static string CreatePersonalTimelineName(int i) => i == 0 ? "@admin" : $"@user{i}"; + public static string CreateOrdinaryTimelineName(int i) => $"t{i}"; + public delegate string TimelineNameGenerator(int i); + + public static IEnumerable TimelineNameGeneratorTestData() + { + yield return new object[] { new TimelineNameGenerator(CreatePersonalTimelineName) }; + yield return new object[] { new TimelineNameGenerator(CreateOrdinaryTimelineName) }; + } + } +} -- cgit v1.2.3