forked from redis/NRedisStack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTargetEnvironmentAttribute.cs
36 lines (32 loc) · 1.15 KB
/
TargetEnvironmentAttribute.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
using Xunit;
namespace NRedisStack.Tests;
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class TargetEnvironmentAttribute : SkipIfRedisAttribute
{
private string targetEnv;
public TargetEnvironmentAttribute(string targetEnv) : base(Comparison.LessThan, "0.0.0")
{
this.targetEnv = targetEnv;
}
public TargetEnvironmentAttribute(string targetEnv, Is environment, Comparison comparison = Comparison.LessThan,
string targetVersion = "0.0.0") : base(environment, comparison, targetVersion)
{
this.targetEnv = targetEnv;
}
public TargetEnvironmentAttribute(string targetEnv, Is environment1, Is environment2, Comparison comparison = Comparison.LessThan,
string targetVersion = "0.0.0") : base(environment1, environment2, comparison, targetVersion)
{
this.targetEnv = targetEnv;
}
public override string? Skip
{
get
{
if (!new RedisFixture().IsTargetConnectionExist(targetEnv))
{
return "Test skipped, because: target environment not found.";
}
return base.Skip;
}
}
}