Skip to content

Commit 3163cdf

Browse files
committed
Simplify testing and cover code fixes
1 parent a965593 commit 3163cdf

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test/LayoutRules/SA1500/SA1500UnitTests.DoWhiles.cs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,24 @@ private void Bar()
373373
while (x == 0)
374374
{
375375
x = 1;
376-
} while (x == 0)
376+
[|}|] while (x == 0)
377+
{
378+
x = 1;
379+
}
380+
}
381+
}";
382+
383+
var fixedCode = @"public class Foo
384+
{
385+
private void Bar()
386+
{
387+
var x = 0;
388+
389+
while (x == 0)
390+
{
391+
x = 1;
392+
}
393+
while (x == 0)
377394
{
378395
x = 1;
379396
}
@@ -383,10 +400,7 @@ private void Bar()
383400
var test = new CSharpTest
384401
{
385402
TestCode = testCode,
386-
ExpectedDiagnostics =
387-
{
388-
Diagnostic().WithLocation(10, 9),
389-
},
403+
FixedCode = fixedCode,
390404
Settings = testSettings,
391405
};
392406

@@ -423,7 +437,7 @@ private void Bar()
423437
424438
do
425439
{
426-
x = 1; } while (x == 0);
440+
x = 1; [|}|] while (x == 0);
427441
}
428442
}";
429443

@@ -443,10 +457,6 @@ private void Bar()
443457
var test = new CSharpTest
444458
{
445459
TestCode = testCode,
446-
ExpectedDiagnostics =
447-
{
448-
Diagnostic().WithLocation(9, 20),
449-
},
450460
FixedCode = fixedTestCode,
451461
Settings = testSettings,
452462
};

0 commit comments

Comments
 (0)