Skip to content

Commit de31124

Browse files
stazzasbjornu
authored andcommitted
Resolving conflicts related to #1644 .
1 parent 4b650f0 commit de31124

16 files changed

+459
-444
lines changed
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
using System.Linq;
1+
using System.Linq;
22
using GitVersion;
33
using GitVersionTask;
4-
using Microsoft.Build.Framework;
54
using NUnit.Framework;
65
using Shouldly;
76

@@ -11,13 +10,12 @@ public class GetVersionTaskTests : TestBase
1110
[Test]
1211
public void OutputsShouldMatchVariableProvider()
1312
{
14-
var taskProperties = typeof(GetVersion)
13+
var taskProperties = typeof( GetVersion.Output )
1514
.GetProperties()
16-
.Where(p => p.GetCustomAttributes(typeof(OutputAttribute), false).Any())
17-
.Select(p => p.Name);
15+
.Select( p => p.Name );
1816

1917
var variablesProperties = VersionVariables.AvailableVariables;
2018

21-
taskProperties.ShouldBe(variablesProperties, ignoreOrder: true);
19+
taskProperties.ShouldBe( variablesProperties, ignoreOrder: true );
2220
}
2321
}

src/GitVersionTask.Tests/GitVersionTask.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
<PackageReference Include="NUnit" Version="3.11.0"></PackageReference>
1818
<packagereference Include="NUnit3TestAdapter" Version="3.13.0"></packagereference>
1919
<PackageReference Include="Shouldly" Version="3.0.2"></PackageReference>
20-
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.9.20" />
2120
</ItemGroup>
2221
<ItemGroup>
2322
<Content Include="Approved\**\*.txt" />
Lines changed: 63 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using System;
22
using System.IO;
33
using GitVersion;
4-
using GitVersionTask.Tests.Mocks;
5-
using Microsoft.Build.Framework;
64
using NUnit.Framework;
75

86
[TestFixture]
@@ -14,207 +12,207 @@ public class InvalidFileCheckerTests : TestBase
1412
[SetUp]
1513
public void CreateTemporaryProject()
1614
{
17-
projectDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
18-
projectFile = Path.Combine(projectDirectory, "Fake.csproj");
15+
projectDirectory = Path.Combine( Path.GetTempPath(), Guid.NewGuid().ToString() );
16+
projectFile = Path.Combine( projectDirectory, "Fake.csproj" );
1917

20-
Directory.CreateDirectory(projectDirectory);
18+
Directory.CreateDirectory( projectDirectory );
2119

22-
File.Create(projectFile).Close();
20+
File.Create( projectFile ).Close();
2321
}
2422

2523
[TearDown]
2624
public void Cleanup()
2725
{
28-
Directory.Delete(projectDirectory, true);
26+
Directory.Delete( projectDirectory, true );
2927
}
3028

3129
[Test]
3230
public void VerifyIgnoreNonAssemblyInfoFile()
3331
{
34-
using (var writer = File.CreateText(Path.Combine(projectDirectory, "SomeOtherFile.cs")))
32+
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "SomeOtherFile.cs" ) ) )
3533
{
36-
writer.Write(@"
34+
writer.Write( @"
3735
using System;
3836
using System.Reflection;
3937
4038
[assembly: AssemblyVersion(""1.0.0.0"")]
41-
");
39+
" );
4240
}
4341

44-
InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "SomeOtherFile.cs" } }, projectFile);
42+
InvalidFileChecker.CheckForInvalidFiles( new[] { "SomeOtherFile.cs" }, projectFile );
4543
}
4644

4745
[Test]
48-
public void VerifyAttributeFoundCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System.Reflection.AssemblyVersion")]string attribute)
46+
public void VerifyAttributeFoundCSharp( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System.Reflection.AssemblyVersion" )]string attribute )
4947
{
50-
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.cs")))
48+
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.cs" ) ) )
5149
{
52-
writer.Write(@"
50+
writer.Write( @"
5351
using System;
5452
using System.Reflection;
5553
5654
[assembly:{0}(""1.0.0.0"")]
57-
", attribute);
55+
", attribute );
5856
}
5957

60-
var ex = Assert.Throws<WarningException>(() => InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.cs" } }, projectFile), attribute);
61-
Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.cs"));
58+
var ex = Assert.Throws<WarningException>( () => InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.cs" }, projectFile ), attribute );
59+
Assert.That( ex.Message, Is.EqualTo( "File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.cs" ) );
6260
}
6361

6462
[Test]
65-
public void VerifyUnformattedAttributeFoundCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System . Reflection . AssemblyVersion")]string attribute)
63+
public void VerifyUnformattedAttributeFoundCSharp( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System . Reflection . AssemblyVersion" )]string attribute )
6664
{
67-
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.cs")))
65+
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.cs" ) ) )
6866
{
69-
writer.Write(@"
67+
writer.Write( @"
7068
using System;
7169
using System.Reflection;
7270
7371
[ assembly :
7472
{0} ( ""1.0.0.0"")]
75-
", attribute);
73+
", attribute );
7674
}
7775

78-
var ex = Assert.Throws<WarningException>(() => InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.cs" } }, projectFile), attribute);
79-
Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.cs"));
76+
var ex = Assert.Throws<WarningException>( () => InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.cs" }, projectFile ), attribute );
77+
Assert.That( ex.Message, Is.EqualTo( "File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.cs" ) );
8078
}
8179

8280
[Test]
83-
public void VerifyCommentWorksCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")]string attribute)
81+
public void VerifyCommentWorksCSharp( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion" )]string attribute )
8482
{
85-
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.cs")))
83+
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.cs" ) ) )
8684
{
87-
writer.Write(@"
85+
writer.Write( @"
8886
using System;
8987
using System.Reflection;
9088
9189
//[assembly: {0}(""1.0.0.0"")]
92-
", attribute);
90+
", attribute );
9391
}
9492

95-
InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.cs" } }, projectFile);
93+
InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.cs" }, projectFile );
9694
}
9795

9896
[Test]
99-
public void VerifyStringWorksCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")]string attribute)
97+
public void VerifyStringWorksCSharp( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion" )]string attribute )
10098
{
101-
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.cs")))
99+
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.cs" ) ) )
102100
{
103-
writer.Write(@"
101+
writer.Write( @"
104102
using System;
105103
using System.Reflection;
106104
107105
public class Temp
108106
{{
109107
static const string Foo = ""[assembly: {0}(""""1.0.0.0"""")]"";
110108
}}
111-
", attribute);
109+
", attribute );
112110
}
113111

114-
InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.cs" } }, projectFile);
112+
InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.cs" }, projectFile );
115113
}
116114

117115
[Test]
118-
public void VerifyIdentifierWorksCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")]string attribute)
116+
public void VerifyIdentifierWorksCSharp( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion" )]string attribute )
119117
{
120-
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.cs")))
118+
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.cs" ) ) )
121119
{
122-
writer.Write(@"
120+
writer.Write( @"
123121
using System;
124122
using System.Reflection;
125123
126124
public class {0}
127125
{{
128126
}}
129-
", attribute);
127+
", attribute );
130128
}
131129

132-
InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.cs" } }, projectFile);
130+
InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.cs" }, projectFile );
133131
}
134132

135133
[Test]
136-
public void VerifyAttributeFoundVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System.Reflection.AssemblyVersion")]string attribute)
134+
public void VerifyAttributeFoundVisualBasic( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System.Reflection.AssemblyVersion" )]string attribute )
137135
{
138-
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.vb")))
136+
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.vb" ) ) )
139137
{
140-
writer.Write(@"
138+
writer.Write( @"
141139
Imports System
142140
Imports System.Reflection
143141
144142
<Assembly:{0}(""1.0.0.0"")>
145-
", attribute);
143+
", attribute );
146144
}
147145

148-
var ex = Assert.Throws<WarningException>(() => InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.vb" } }, projectFile), attribute);
149-
Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.vb"));
146+
var ex = Assert.Throws<WarningException>( () => InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.vb" }, projectFile ), attribute );
147+
Assert.That( ex.Message, Is.EqualTo( "File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.vb" ) );
150148
}
151149

152150
[Test]
153-
public void VerifyUnformattedAttributeFoundVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System . Reflection . AssemblyVersion")]string attribute)
151+
public void VerifyUnformattedAttributeFoundVisualBasic( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System . Reflection . AssemblyVersion" )]string attribute )
154152
{
155-
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.vb")))
153+
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.vb" ) ) )
156154
{
157-
writer.Write(@"
155+
writer.Write( @"
158156
Imports System
159157
Imports System.Reflection
160158
161159
< Assembly :
162160
{0} ( ""1.0.0.0"")>
163-
", attribute);
161+
", attribute );
164162
}
165163

166-
var ex = Assert.Throws<WarningException>(() => InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.vb" } }, projectFile), attribute);
167-
Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.vb"));
164+
var ex = Assert.Throws<WarningException>( () => InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.vb" }, projectFile ), attribute );
165+
Assert.That( ex.Message, Is.EqualTo( "File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.vb" ) );
168166
}
169167

170168
[Test]
171-
public void VerifyCommentWorksVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")]string attribute)
169+
public void VerifyCommentWorksVisualBasic( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion" )]string attribute )
172170
{
173-
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.vb")))
171+
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.vb" ) ) )
174172
{
175-
writer.Write(@"
173+
writer.Write( @"
176174
Imports System
177175
Imports System.Reflection
178176
179177
'<Assembly: {0}(""1.0.0.0"")>
180-
", attribute);
178+
", attribute );
181179
}
182180

183-
InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.vb" } }, projectFile);
181+
InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.vb" }, projectFile );
184182
}
185183

186184
[Test]
187-
public void VerifyStringWorksVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")]string attribute)
185+
public void VerifyStringWorksVisualBasic( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion" )]string attribute )
188186
{
189-
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.vb")))
187+
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.vb" ) ) )
190188
{
191-
writer.Write(@"
189+
writer.Write( @"
192190
Imports System
193191
Imports System.Reflection
194192
195193
Public Class Temp
196194
static const string Foo = ""<Assembly: {0}(""""1.0.0.0"""")>"";
197195
End Class
198-
", attribute);
196+
", attribute );
199197
}
200198

201-
InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.vb" } }, projectFile);
199+
InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.vb" }, projectFile );
202200
}
203201

204202
[Test]
205-
public void VerifyIdentifierWorksVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")]string attribute)
203+
public void VerifyIdentifierWorksVisualBasic( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion" )]string attribute )
206204
{
207-
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.vb")))
205+
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.vb" ) ) )
208206
{
209-
writer.Write(@"
207+
writer.Write( @"
210208
Imports System
211209
Imports System.Reflection
212210
213211
Public Class {0}
214212
End Class
215-
", attribute);
213+
", attribute );
216214
}
217215

218-
InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.vb" } }, projectFile);
216+
InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.vb" }, projectFile );
219217
}
220218
}

src/GitVersionTask.Tests/Mocks/MockBuildEngine.cs

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)