aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline.Tests/IntegratedTests/BaseTimelineTest.cs
blob: 006b5128a5ec14ecce5575366d0f8a350b976e43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 HttpTimelineCreateRequest { 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<object[]> TimelineNameGeneratorTestData()
        {
            yield return new object[] { new TimelineNameGenerator(CreatePersonalTimelineName) };
            yield return new object[] { new TimelineNameGenerator(CreateOrdinaryTimelineName) };
        }
    }
}