Skip to content

Commit 6ee7d49

Browse files
committed
last batch of tests was finally moved to xunit!
1 parent b66009e commit 6ee7d49

9 files changed

Lines changed: 240 additions & 342 deletions

File tree

CI.MSBuild.Test/CI.MSBuild.Test.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" />
1212
<PackageReference Include="xunit" Version="$(xunitVersion)" />
13-
<PackageReference Include="xunit.runner.visualstudio" Version="$(xunitRunnerVisualstudioVersion)" />
14-
<PackageReference Include="coverlet.collector" Version="$(coverletCollectorVersion)" />
13+
<PackageReference Include="xunit.runner.visualstudio" Version="$(xunitRunnerVisualstudioVersion)">
14+
<PrivateAssets>all</PrivateAssets>
15+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
16+
</PackageReference>
1517
</ItemGroup>
1618

1719
<ItemGroup>

versions.props

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
<PropertyGroup>
44
<MicrosoftCodeAnalysisNetAnalyzersVersion>6.0.0</MicrosoftCodeAnalysisNetAnalyzersVersion>
5-
<MicrosoftUnitTestFrameworkExtensionsVersion>2.0.0</MicrosoftUnitTestFrameworkExtensionsVersion>
6-
<MicrosoftNETTestSdkVersion>16.5.0</MicrosoftNETTestSdkVersion>
7-
<xunitVersion>2.4.0</xunitVersion>
8-
<xunitRunnerVisualstudioVersion>2.4.0</xunitRunnerVisualstudioVersion>
9-
<coverletCollectorVersion>1.2.0</coverletCollectorVersion>
5+
<MicrosoftNETTestSdkVersion>17.0.0</MicrosoftNETTestSdkVersion>
6+
<xunitVersion>2.4.1</xunitVersion>
7+
<xunitRunnerVisualstudioVersion>2.4.3</xunitRunnerVisualstudioVersion>
108
<AvalonEditVersion>6.1.2.30</AvalonEditVersion>
119
<SevenZipSharpVersion>0.64.0</SevenZipSharpVersion>
1210
<UdeSignedVersion>0.1.1</UdeSignedVersion>

vsSolutionBuildEventTest/Actions/DTEOperationTest.cs

Lines changed: 30 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,67 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Runtime.InteropServices;
4-
using Microsoft.VisualStudio.TestTools.UnitTesting;
54
using net.r_eg.EvMSBuild.Exceptions;
65
using net.r_eg.vsSBE.Actions;
76
using net.r_eg.vsSBE.Events;
7+
using Xunit;
88

99
namespace net.r_eg.vsSBE.Test.Actions
1010
{
11-
[TestClass]
1211
public class DTEOperationTest
1312
{
14-
[TestMethod]
13+
[Fact]
1514
public void dtePreparedTest()
1615
{
17-
DTEOperation target = new DTEOperation((IEnvironment)null, SolutionEventType.General);
16+
DTEOperation target = new(null, SolutionEventType.General);
1817

1918
string line = "File.OpenProject(\"c:\\path\\app.sln\")";
2019
DTEOperation.DTEPrepared actual = target.parse(line);
2120

22-
Assert.AreEqual("File.OpenProject", actual.name);
23-
Assert.AreEqual("\"c:\\path\\app.sln\"", actual.args);
21+
Assert.Equal("File.OpenProject", actual.name);
22+
Assert.Equal("\"c:\\path\\app.sln\"", actual.args);
2423
}
2524

26-
[TestMethod]
25+
[Fact]
2726
public void dtePreparedTest2()
2827
{
29-
DTEOperation target = new DTEOperation((IEnvironment)null, SolutionEventType.General);
28+
DTEOperation target = new(null, SolutionEventType.General);
3029

3130
string line = "Debug.StartWithoutDebugging";
3231
DTEOperation.DTEPrepared actual = target.parse(line);
3332

34-
Assert.AreEqual("Debug.StartWithoutDebugging", actual.name);
35-
Assert.AreEqual("", actual.args);
33+
Assert.Equal("Debug.StartWithoutDebugging", actual.name);
34+
Assert.Equal(string.Empty, actual.args);
3635
}
3736

38-
[TestMethod]
39-
[ExpectedException(typeof(IncorrectSyntaxException))]
40-
public void dtePreparedTest3()
37+
[Theory]
38+
[InlineData("Debug StartWithoutDebugging")]
39+
[InlineData("")]
40+
public void dtePreparedTheory1(string line)
4141
{
42-
DTEOperation target = new DTEOperation((IEnvironment)null, SolutionEventType.General);
42+
DTEOperation target = new(null, SolutionEventType.General);
4343

44-
string line = "Debug StartWithoutDebugging";
45-
DTEOperation.DTEPrepared actual = target.parse(line);
44+
Assert.Throws<IncorrectSyntaxException>(() => target.parse(line));
4645
}
4746

48-
[TestMethod]
49-
[ExpectedException(typeof(IncorrectSyntaxException))]
50-
public void dtePreparedTest4()
51-
{
52-
DTEOperation target = new DTEOperation((IEnvironment)null, SolutionEventType.General);
53-
54-
string line = "";
55-
DTEOperation.DTEPrepared actual = target.parse(line);
56-
}
57-
58-
[TestMethod]
47+
[Fact]
5948
public void dtePreparedTest5()
6049
{
6150
DTEOperation target = new DTEOperation((IEnvironment)null, SolutionEventType.General);
6251

6352
string line = " OpenProject(arg) ";
6453
DTEOperation.DTEPrepared actual = target.parse(line);
6554

66-
Assert.AreEqual("OpenProject", actual.name);
67-
Assert.AreEqual("arg", actual.args);
55+
Assert.Equal("OpenProject", actual.name);
56+
Assert.Equal("arg", actual.args);
6857
}
6958

70-
[TestMethod]
59+
[Fact]
7160
public void execTest()
7261
{
73-
DTEOperationAccessor.ToExec target = new DTEOperationAccessor.ToExec(-1);
62+
DTEOperationAccessor.ToExec target = new(-1);
7463

75-
Queue<DTEOperation.DTEPrepared> commands = new Queue<DTEOperation.DTEPrepared>();
64+
Queue<DTEOperation.DTEPrepared> commands = new();
7665
commands.Enqueue(new DTEOperation.DTEPrepared("Build.Cancel", ""));
7766
commands.Enqueue(new DTEOperation.DTEPrepared("File.OpenProject", "app.sln"));
7867
commands.Enqueue(new DTEOperation.DTEPrepared("Debug.Start", ""));
@@ -83,14 +72,14 @@ public void execTest()
8372
target.exec(commands, false);
8473

8574
Queue<DTEOperation.DTEPrepared> actual = target.getExecuted();
86-
Assert.IsTrue(actual.Count == expected.Length);
75+
Assert.True(actual.Count == expected.Length);
8776

8877
foreach(DTEOperation.DTEPrepared obj in expected) {
89-
Assert.AreEqual(actual.Dequeue(), obj);
78+
Assert.Equal(actual.Dequeue(), obj);
9079
}
9180
}
9281

93-
[TestMethod]
82+
[Fact]
9483
public void execTest2()
9584
{
9685
DTEOperationAccessor.ToExec target = new DTEOperationAccessor.ToExec(1);
@@ -111,14 +100,14 @@ public void execTest2()
111100
}
112101

113102
Queue<DTEOperation.DTEPrepared> actual = target.getExecuted();
114-
Assert.IsTrue(actual.Count == expected.Length);
103+
Assert.True(actual.Count == expected.Length);
115104

116105
foreach(DTEOperation.DTEPrepared obj in expected) {
117-
Assert.AreEqual(actual.Dequeue(), obj);
106+
Assert.Equal(actual.Dequeue(), obj);
118107
}
119108
}
120109

121-
[TestMethod]
110+
[Fact]
122111
public void execTest3()
123112
{
124113
DTEOperationAccessor.ToExec target = new DTEOperationAccessor.ToExec(2);
@@ -140,12 +129,12 @@ public void execTest3()
140129
}
141130

142131
Queue<DTEOperation.DTEPrepared> actual = target.getExecuted();
143-
Assert.IsTrue(actual.Count != expected.Length);
144-
Assert.IsTrue(actual.Count == 2);
132+
Assert.True(actual.Count != expected.Length);
133+
Assert.True(actual.Count == 2);
145134

146135
int idx = 0;
147136
foreach(DTEOperation.DTEPrepared obj in actual) {
148-
Assert.AreEqual(expected[idx++], obj);
137+
Assert.Equal(expected[idx++], obj);
149138
}
150139
}
151140

vsSolutionBuildEventTest/MSBuild/ParserTest.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
using Microsoft.VisualStudio.TestTools.UnitTesting;
2-
using Moq;
1+
using Moq;
32
using net.r_eg.EvMSBuild;
43
using net.r_eg.MvsSln;
4+
using Xunit;
55

66
namespace net.r_eg.vsSBE.Test.MSBuild
77
{
8-
[TestClass]
98
public class ParserTest
109
{
11-
[TestMethod]
10+
[Fact]
1211
public void getPropertyTest()
1312
{
1413
var mockDte2 = new Mock<EnvDTE80.DTE2>();
@@ -24,8 +23,8 @@ public void getPropertyTest()
2423
mockDte2.SetupGet(p => p.Solution).Returns(mockSolution.Object);
2524

2625
var target = new EvMSBuilder(new Environment(mockDte2.Object));
27-
Assert.IsNotNull(target.GetPropValue(PropertyNames.CONFIG));
28-
Assert.IsNotNull(target.GetPropValue(PropertyNames.PLATFORM));
26+
Assert.NotNull(target.GetPropValue(PropertyNames.CONFIG));
27+
Assert.NotNull(target.GetPropValue(PropertyNames.PLATFORM));
2928
}
3029
}
3130
}

0 commit comments

Comments
 (0)