Skip to content

Commit 3cbf0b3

Browse files
committed
Improved TestInfo & its test
1 parent d2f243b commit 3cbf0b3

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

Orm/Xtensive.Orm.Tests.Framework/TestInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public enum GithubActionsEvents
2222
PullRequest,
2323
WorkflowDispatch,
2424
WorkflowCall,
25+
WorkflowRun,
2526
Push,
2627
Schedule
2728
}
@@ -100,6 +101,7 @@ private static IEnumerable<T> GetMethodAttributes<T>() where T : Attribute
100101
"pull_request_target" => GithubActionsEvents.PullRequest,
101102
"workflow_dispatch" => GithubActionsEvents.WorkflowDispatch,
102103
"workflow_call" => GithubActionsEvents.WorkflowCall,
104+
"workflow_run" => GithubActionsEvents.WorkflowRun,
103105
"schedule" => GithubActionsEvents.Schedule,
104106
_ => null
105107
};

Orm/Xtensive.Orm.Tests/TestInfoTest.cs

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void IsBuildServerTest()
2121
public void IsGithubActionsTest()
2222
{
2323
var githubActions = Environment.GetEnvironmentVariable("GITHUB_WORKSPACE");
24-
Console.WriteLine($"GITHUB_WORKSPACE : {githubActions}; IsBuildServer : {TestInfo.IsGithubActions}");
24+
Console.WriteLine($"GITHUB_WORKSPACE : {githubActions}; IsGithubActions : {TestInfo.IsGithubActions}");
2525

2626
if (githubActions is null) {
2727
Assert.That(TestInfo.IsGithubActions, Is.False);
@@ -34,26 +34,24 @@ public void IsGithubActionsTest()
3434
Assert.That(TestInfo.NoIgnoreOnGithubActions);
3535
}
3636
else {
37-
Assert.That(TestInfo.IsGithubActions, Is.EqualTo(githubActions.Equals("true", StringComparison.OrdinalIgnoreCase)));
38-
if (githubActions.Equals("true", StringComparison.OrdinalIgnoreCase)) {
37+
Assert.That(TestInfo.IsGithubActions, Is.True);
3938

40-
var githubActionsTrigger = Environment.GetEnvironmentVariable("GITHUB_EVENT_NAME");
41-
Console.WriteLine($"GITHUB_EVENT_NAME : {githubActionsTrigger} ; GithubActionTrigger : {TestInfo.GithubActionTrigger}");
42-
if (githubActionsTrigger is null) {
43-
Assert.That(TestInfo.GithubActionTrigger.HasValue, Is.False);
44-
}
45-
else {
46-
Assert.That(TestInfo.GithubActionTrigger.HasValue, Is.True);
47-
}
39+
var githubActionsTrigger = Environment.GetEnvironmentVariable("GITHUB_EVENT_NAME");
40+
Console.WriteLine($"GITHUB_EVENT_NAME : {githubActionsTrigger} ; GithubActionTrigger : {TestInfo.GithubActionTrigger}");
41+
if (githubActionsTrigger is null) {
42+
Assert.That(TestInfo.GithubActionTrigger.HasValue, Is.False);
43+
}
44+
else {
45+
Assert.That(TestInfo.GithubActionTrigger.HasValue, Is.True);
46+
}
4847

49-
var githbuActionsNoIgnore = Environment.GetEnvironmentVariable("GA_NO_IGNORE");
50-
Console.WriteLine($"GA_NO_IGNORE : {githbuActionsNoIgnore} ; NoIgnoreOnGithubActions : {TestInfo.NoIgnoreOnGithubActions}");
51-
if (githbuActionsNoIgnore is null) {
52-
Assert.That(TestInfo.NoIgnoreOnGithubActions, Is.False);
53-
}
54-
else {
55-
Assert.That(TestInfo.NoIgnoreOnGithubActions, Is.EqualTo(githbuActionsNoIgnore.Equals("true", StringComparison.OrdinalIgnoreCase)));
56-
}
48+
var githbuActionsNoIgnore = Environment.GetEnvironmentVariable("GA_NO_IGNORE");
49+
Console.WriteLine($"GA_NO_IGNORE : {githbuActionsNoIgnore} ; NoIgnoreOnGithubActions : {TestInfo.NoIgnoreOnGithubActions}");
50+
if (githbuActionsNoIgnore is null) {
51+
Assert.That(TestInfo.NoIgnoreOnGithubActions, Is.False);
52+
}
53+
else {
54+
Assert.That(TestInfo.NoIgnoreOnGithubActions, Is.EqualTo(githbuActionsNoIgnore.Equals("true", StringComparison.OrdinalIgnoreCase)));
5755
}
5856
}
5957
}

0 commit comments

Comments
 (0)