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

Commit 5d3ce5a

Browse files
committed
Fixed the unit tests
1 parent 76a8ab7 commit 5d3ce5a

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

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

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,25 @@ namespace Microsoft.DotNet.CodeFormatting.Tests
1818
/// </summary>
1919
public sealed class CombinationTest : CodeFormattingTestBase, IDisposable
2020
{
21-
private static FormattingEngineImplementation s_formattingEngine;
22-
23-
static CombinationTest()
24-
{
25-
s_formattingEngine = (FormattingEngineImplementation)FormattingEngine.Create();
26-
}
21+
private FormattingEngineImplementation _formattingEngine;
2722

2823
public CombinationTest()
2924
{
30-
s_formattingEngine.CopyrightHeader = ImmutableArray.Create("// header");
31-
s_formattingEngine.AllowTables = true;
32-
s_formattingEngine.FormatLogger = new EmptyFormatLogger();
33-
s_formattingEngine.PreprocessorConfigurations = ImmutableArray<string[]>.Empty;
25+
_formattingEngine = (FormattingEngineImplementation)FormattingEngine.Create();
26+
_formattingEngine.CopyrightHeader = ImmutableArray.Create("// header");
27+
_formattingEngine.AllowTables = true;
28+
_formattingEngine.FormatLogger = new EmptyFormatLogger();
29+
_formattingEngine.PreprocessorConfigurations = ImmutableArray<string[]>.Empty;
3430
}
3531

3632
public void Dispose()
3733
{
38-
s_formattingEngine.AllowTables = false;
34+
_formattingEngine.AllowTables = false;
3935
}
4036

4137
protected override async Task<Document> RewriteDocumentAsync(Document document)
4238
{
43-
var solution = await s_formattingEngine.FormatCoreAsync(
39+
var solution = await _formattingEngine.FormatCoreAsync(
4440
document.Project.Solution,
4541
new[] { document.Id },
4642
CancellationToken.None);
@@ -147,7 +143,7 @@ internal void M()
147143
#endif
148144
}";
149145

150-
s_formattingEngine.PreprocessorConfigurations = ImmutableArray.CreateRange(new[] { new[] { "DOG" } });
146+
_formattingEngine.PreprocessorConfigurations = ImmutableArray.CreateRange(new[] { new[] { "DOG" } });
151147
Verify(text, expected, runFormatter: false);
152148
}
153149

@@ -221,7 +217,7 @@ void M() {
221217
#endif
222218
}";
223219

224-
s_formattingEngine.PreprocessorConfigurations = ImmutableArray.CreateRange(new[] { new[] { "TEST" } });
220+
_formattingEngine.PreprocessorConfigurations = ImmutableArray.CreateRange(new[] { new[] { "TEST" } });
225221
Verify(text, expected, runFormatter: false);
226222
}
227223

src/Microsoft.DotNet.CodeFormatting/RuleAttribute.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public SyntaxRuleAttribute(string name, string description, int order)
2121
Name = name;
2222
Description = description;
2323
Order = order;
24+
DefaultRule = true;
2425
}
2526

2627
[DefaultValue("")]
@@ -46,6 +47,7 @@ public LocalSemanticRuleAttribute(string name, string description, int order)
4647
Name = name;
4748
Description = description;
4849
Order = order;
50+
DefaultRule = true;
4951
}
5052

5153
[DefaultValue("")]
@@ -71,6 +73,7 @@ public GlobalSemanticRuleAttribute(string name, string description, int order)
7173
Name = name;
7274
Description = description;
7375
Order = order;
76+
DefaultRule = true;
7477
}
7578

7679
[DefaultValue("")]

0 commit comments

Comments
 (0)