-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestFilter.cs
55 lines (46 loc) · 1.38 KB
/
TestFilter.cs
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System.Collections.Generic;
using System.Linq;
using ConfIT.Extension;
using static System.Environment;
namespace ConfIT
{
public class TestFilter
{
public List<string> Tags { get; set; }
public List<string> TestNames { get; set; }
public static TestFilter CreateForTags(string tags)
{
return new TestFilter
{
Tags = tags.Split(",").ToList(),
};
}
public static TestFilter CreateForTagsFromEnvVariable(string tagKey)
{
List<string> tags = null;
if (!tagKey.IsNullOrWhiteSpace())
tags = GetEnvironmentVariable(tagKey)?.Split(",").ToList();
return new TestFilter
{
Tags = tags
};
}
public static TestFilter CreateForTests(string testNames)
{
return new TestFilter
{
TestNames = testNames.Split(",").ToList(),
};
}
public static TestFilter CreateForTestsFromEnvVariable(string testNamesKey)
{
List<string> tests = null;
if (!testNamesKey.IsNullOrWhiteSpace())
tests = GetEnvironmentVariable(testNamesKey)?.Split(",").ToList();
return new TestFilter
{
TestNames = tests
};
}
}
}