Skip to content

Commit

Permalink
Fixed issue in CodeFixVerifier
Browse files Browse the repository at this point in the history
  • Loading branch information
vweijsters committed Aug 13, 2015
1 parent f750a8b commit 29de69d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -642,37 +642,8 @@ public void Bar(int i)
else Debug.Assert(false); else if (i == 13) Debug.Assert(true);//24
}
}";
var fixedCode = @"using System.Diagnostics;
public class TypeName
{
public void Bar(int i)
{
if (i == 0)
Debug.Assert(true);
else
Debug.Assert(false);//8

if (i == 1)
Debug.Assert(true);
else if (i == 2) Debug.Assert(false);//10
if (i == 3)
Debug.Assert(true);
else if (i == 4) Debug.Assert(false);//14
if (i == 5) Debug.Assert(true); else if (i == 6) Debug.Assert(false); else Debug.Assert(false);//16
if (i == 7) if (i == 8) Debug.Assert(false); else Debug.Assert(false); else Debug.Assert(true);//18
if (i == 9)
if (i == 10) Debug.Assert(false); else Debug.Assert(false); else Debug.Assert(true);//21
if (i == 11) if (i == 12) Debug.Assert(false);
else Debug.Assert(false); else if (i == 13) Debug.Assert(true);//24
}
}";
var batchFixedCode = @"using System.Diagnostics;
var fixedCode = @"using System.Diagnostics;
public class TypeName
{
public void Bar(int i)
Expand Down Expand Up @@ -746,7 +717,7 @@ public void Bar(int i)

await this.VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
////await this.VerifyCSharpDiagnosticAsync(fixedCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
await this.VerifyCSharpFixAsync(testCode, fixedCode, batchFixedCode, cancellationToken: CancellationToken.None).ConfigureAwait(false);
await this.VerifyCSharpFixAsync(testCode, fixedCode, fixedCode, cancellationToken: CancellationToken.None).ConfigureAwait(false);
}

/// <summary>
Expand Down Expand Up @@ -833,7 +804,8 @@ public void Bar(int i)
{
if (i == 0)
Debug.Assert(true);
else Debug.Assert(false);
else
Debug.Assert(false);
}
}";

Expand Down Expand Up @@ -930,21 +902,12 @@ public class TypeName
public void Bar(int i)
{
if (i == 0)
if (i == 0) Debug.Assert(true);
}
}";

var batchFixedTestCode = @"using System.Diagnostics;
public class TypeName
{
public void Bar(int i)
{
if (i == 0)
if (i == 0) Debug.Assert(true);
if (i == 0)
Debug.Assert(true);
}
}";

await this.VerifyCSharpFixAsync(testCode, fixedTestCode, batchFixedTestCode).ConfigureAwait(false);
await this.VerifyCSharpFixAsync(testCode, fixedTestCode, fixedTestCode).ConfigureAwait(false);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ private static bool AreDiagnosticsDifferent(ImmutableArray<Diagnostic> analyzerD

for (var i = 0; i < analyzerDiagnostics.Length; i++)
{
if (analyzerDiagnostics[i].Id != previousDiagnostics[i].Id)
if ((analyzerDiagnostics[i].Id != previousDiagnostics[i].Id)
|| (analyzerDiagnostics[i].Location.SourceSpan != previousDiagnostics[i].Location.SourceSpan))
{
return true;
}
Expand Down

0 comments on commit 29de69d

Please sign in to comment.