Skip to content

Commit

Permalink
Add tests for containing type and contained member conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Nov 27, 2015
1 parent 92ad652 commit 27d36be
Showing 1 changed file with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,27 @@ public interface IFoo { }";
await this.VerifyCSharpFixAsync(testCode, fixedCode, cancellationToken: CancellationToken.None).ConfigureAwait(false);
}

[Fact]
public async Task TestInterfaceDeclarationDoesNotStartWithIWithMemberConflictAsync()
{
string testCode = @"
public interface Foo
{
int IFoo { get; }
}";
string fixedCode = @"
public interface IFoo1
{
int IFoo { get; }
}";

DiagnosticResult expected = this.CSharpDiagnostic().WithLocation(2, 18);

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

[Fact]
public async Task TestNestedInterfaceDeclarationDoesNotStartWithIWithConflictAsync()
{
Expand Down Expand Up @@ -237,6 +258,31 @@ public interface IFoo { }
await this.VerifyCSharpFixAsync(testCode, fixedCode, cancellationToken: CancellationToken.None).ConfigureAwait(false);
}

[Fact]
public async Task TestNestedInterfaceDeclarationDoesNotStartWithIWithContainingTypeConflictAsync()
{
string testCode = @"
public class IFoo
{
public interface Foo
{
}
}";
string fixedCode = @"
public class IFoo
{
public interface IFoo1
{
}
}";

DiagnosticResult expected = this.CSharpDiagnostic().WithLocation(4, 22);

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

[Fact]
public async Task TestNestedInterfaceDeclarationDoesNotStartWithIWithNonInterfaceConflictAsync()
{
Expand Down

0 comments on commit 27d36be

Please sign in to comment.