1
- using System . CommandLine ;
1
+ using System . CommandLine ;
2
2
using GitVersion . Infrastructure ;
3
3
using Microsoft . CodeAnalysis ;
4
+ using Microsoft . CodeAnalysis . CSharp ;
4
5
using Microsoft . CodeAnalysis . CSharp . Testing ;
5
6
using Microsoft . CodeAnalysis . Testing ;
6
7
@@ -11,8 +12,6 @@ public class SystemCommandlineGeneratorTests
11
12
/*language=cs*/
12
13
private const string TestCommandSourceCode =
13
14
"""
14
- using System.Threading;
15
- using System.Threading.Tasks;
16
15
using GitVersion.Infrastructure;
17
16
18
17
namespace GitVersion.Commands;
@@ -32,6 +31,19 @@ public Task<int> InvokeAsync(TestCommandSettings settings, CancellationToken can
32
31
}
33
32
}
34
33
34
+ """ ;
35
+
36
+ /*language=cs*/
37
+ private const string GlobalUsingsCode =
38
+ """
39
+ // <autogenerated />
40
+ global using global::System;
41
+ global using global::System.Collections.Generic;
42
+ global using global::System.IO;
43
+ global using global::System.Linq;
44
+ global using global::System.Net.Http;
45
+ global using global::System.Threading;
46
+ global using global::System.Threading.Tasks;
35
47
""" ;
36
48
37
49
/*language=cs*/
@@ -40,8 +52,6 @@ public Task<int> InvokeAsync(TestCommandSettings settings, CancellationToken can
40
52
{{ Content . GeneratedHeader }}
41
53
using System.CommandLine;
42
54
using System.CommandLine.Binding;
43
- using System.Threading;
44
- using System.Threading.Tasks;
45
55
46
56
using GitVersion.Commands;
47
57
@@ -105,9 +115,7 @@ public void RegisterTypes(IContainerRegistrar services)
105
115
private const string ExpectedRootCommandImplText =
106
116
$$ """
107
117
{{ Content . GeneratedHeader }}
108
- using System.Collections.Generic;
109
118
using System.CommandLine;
110
- using System.Linq;
111
119
112
120
using GitVersion;
113
121
namespace GitVersion.Generated;
@@ -147,6 +155,7 @@ public async Task ValidateGeneratedCommandImplementation()
147
155
{
148
156
Sources =
149
157
{
158
+ ( generatorType , "GlobalUsings.cs" , GlobalUsingsCode ) ,
150
159
( generatorType , "TestCommand.cs" , TestCommandSourceCode )
151
160
} ,
152
161
GeneratedSources =
0 commit comments