Skip to content

Commit 048f6b1

Browse files
stazzasbjornu
authored andcommitted
Making GitVersionTask.Tests compilable again.
1 parent 0ccb64d commit 048f6b1

File tree

4 files changed

+13
-102
lines changed

4 files changed

+13
-102
lines changed

src/GitVersionTask.Tests/GetVersionTaskTests.cs

Lines changed: 2 additions & 4 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,9 +10,8 @@ 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())
1715
.Select(p => p.Name);
1816

1917
var variablesProperties = VersionVariables.AvailableVariables;

src/GitVersionTask.Tests/InvalidFileCheckerTests.cs

Lines changed: 11 additions & 13 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]
@@ -41,7 +39,7 @@ public void VerifyIgnoreNonAssemblyInfoFile()
4139
");
4240
}
4341

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

4745
[Test]
@@ -57,7 +55,7 @@ public void VerifyAttributeFoundCSharp([Values("AssemblyVersion", "AssemblyFileV
5755
", attribute);
5856
}
5957

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

@@ -75,7 +73,7 @@ public void VerifyUnformattedAttributeFoundCSharp([Values("AssemblyVersion", "As
7573
", attribute);
7674
}
7775

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

@@ -92,7 +90,7 @@ public void VerifyCommentWorksCSharp([Values("AssemblyVersion", "AssemblyFileVer
9290
", 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]
@@ -111,7 +109,7 @@ public class Temp
111109
", 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]
@@ -129,7 +127,7 @@ public class {0}
129127
", 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]
@@ -145,7 +143,7 @@ Imports System.Reflection
145143
", attribute);
146144
}
147145

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

@@ -163,7 +161,7 @@ Imports System.Reflection
163161
", attribute);
164162
}
165163

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

@@ -180,7 +178,7 @@ Imports System.Reflection
180178
", 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]
@@ -198,7 +196,7 @@ End Class
198196
", 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]
@@ -215,6 +213,6 @@ End Class
215213
", 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.

src/GitVersionTask.Tests/Mocks/MockTaskItem.cs

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

0 commit comments

Comments
 (0)