Skip to content
This repository was archived by the owner on Jul 12, 2022. It is now read-only.

Commit 7cfa7ee

Browse files
committed
Fix Tests
A couple tests were broken due to being out of sync with source changes. The Xunit update split the Xunit API into two different assemblies (Core and Assert): make sure both are referenced.
1 parent 4a2eba6 commit 7cfa7ee

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

src/Microsoft.DotNet.CodeFormatting.Tests/Rules/CombinationTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ public void RequiredRuntimeAttribute()
353353
}
354354
}";
355355

356+
// Using location rule is off by default.
357+
ToggleRule(UsingLocationRule.Name, enabled: true);
356358
Verify(source, expected);
357359
}
358360
}

src/Microsoft.DotNet.CodeFormatting.Tests/Rules/ExplicitVisibilityRuleTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ private unsafe C(int p1, int p2) { }
559559
public void CommentAttributeAndMultipleField()
560560
{
561561
var text = @"
562-
class C
562+
class C
563563
{
564564
// Hello
565565
[Attr]
@@ -568,7 +568,7 @@ class C
568568
};";
569569

570570
var expected = @"
571-
internal class C
571+
internal class C
572572
{
573573
// Hello
574574
[Attr]

src/Microsoft.DotNet.CodeFormatting.Tests/Rules/PrivateFieldNamingRuleTests.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ class T
4444
// some trivia
4545
private int _k = 1, _s = 2, _rsk_yz = 3, _y_z;
4646
// some trivia
47-
[ThreadStatic]
48-
static int t_r;
49-
[ThreadStaticAttribute]
50-
static int t_r;
47+
[ThreadStatic] static int t_r;
48+
[ThreadStaticAttribute] static int t_r;
5149
}";
5250
Verify(text, expected);
5351
}

src/XUnitConverter.Tests/ConverterTestBase.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@
55
using Microsoft.CodeAnalysis;
66
using Microsoft.CodeAnalysis.Formatting;
77
using Microsoft.CodeAnalysis.Text;
8-
using System;
9-
using System.Collections.Generic;
108
using System.Linq;
11-
using System.Text;
129
using System.Threading;
1310
using System.Threading.Tasks;
1411
using Xunit;
15-
using XUnitConverter;
1612

1713
namespace XUnitConverter.Tests
1814
{
@@ -21,7 +17,8 @@ public abstract class ConverterTestBase
2117
private static readonly MetadataReference s_CorlibReference = MetadataReference.CreateFromFile(typeof(object).Assembly.Location);
2218
private static readonly MetadataReference s_SystemCoreReference = MetadataReference.CreateFromFile(typeof(Enumerable).Assembly.Location);
2319
private static readonly MetadataReference s_MSTestReference = MetadataReference.CreateFromFile(typeof(Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute).Assembly.Location);
24-
private static readonly MetadataReference s_XunitReference = MetadataReference.CreateFromFile(typeof(FactAttribute).Assembly.Location);
20+
private static readonly MetadataReference s_XunitCoreReference = MetadataReference.CreateFromFile(typeof(Xunit.FactAttribute).Assembly.Location);
21+
private static readonly MetadataReference s_XunitAssertReference = MetadataReference.CreateFromFile(typeof(Xunit.Assert).Assembly.Location);
2522

2623
protected abstract ConverterBase CreateConverter();
2724

@@ -53,7 +50,8 @@ private Project CreateSolution(string source)
5350
s_CorlibReference,
5451
s_SystemCoreReference,
5552
s_MSTestReference,
56-
s_XunitReference
53+
s_XunitCoreReference,
54+
s_XunitAssertReference
5755
};
5856

5957
var solution = new AdhocWorkspace()

src/XUnitConverter.Tests/XUnitConverter.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</PropertyGroup>
55
<ItemGroup>
66
<ProjectReference Include="..\XUnitConverter\XUnitConverter.csproj" />
7-
<PackageReference Include="xunit" Version="2.4.0" />
7+
<PackageReference Include="xunit" Version="2.4.0" />
88
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
99
<PackageReference Include="Microsoft.VisualStudio.TestPlatform" Version="14.0.0.1" />
1010
</ItemGroup>

0 commit comments

Comments
 (0)