-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GH-70] - remaining tests for visual basic code fix providers
- Loading branch information
Showing
9 changed files
with
1,852 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...alSetupSpecificationCodeFixProviderTests/InternalSetupSpecificationCodeFixActionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System.Threading.Tasks; | ||
using Microsoft.CodeAnalysis.CodeFixes; | ||
using Microsoft.CodeAnalysis.Diagnostics; | ||
using NSubstitute.Analyzers.Tests.Shared.CodeFixProviders; | ||
using NSubstitute.Analyzers.VisualBasic.CodeFixProviders; | ||
using NSubstitute.Analyzers.VisualBasic.DiagnosticAnalyzers; | ||
using Xunit; | ||
|
||
namespace NSubstitute.Analyzers.Tests.VisualBasic.CodeFixProvidersTests.InternalSetupSpecificationCodeFixProviderTests | ||
{ | ||
public class InternalSetupSpecificationCodeFixActionsTests : VisualBasicCodeFixActionsVerifier, IInternalSetupSpecificationCodeFixActionsVerifier | ||
{ | ||
[Fact] | ||
public async Task CreateCodeActions_InProperOrder() | ||
{ | ||
var source = @"Imports NSubstitute | ||
Imports System.Runtime.CompilerServices | ||
Namespace MyNamespace | ||
Public Class Foo | ||
Friend Overridable Function Bar() As Integer | ||
Return 1 | ||
End Function | ||
End Class | ||
Public Class FooTests | ||
Public Sub Test() | ||
Dim substitute = NSubstitute.Substitute.[For](Of Foo)() | ||
Dim x = substitute.Bar().Returns(1) | ||
End Sub | ||
End Class | ||
End Namespace | ||
"; | ||
await VerifyCodeActions(source, "Add protected modifier", "Replace friend with public modifier", "Add InternalsVisibleTo attribute"); | ||
} | ||
|
||
[Fact] | ||
public async Task DoesNotCreateCodeActions_WhenSymbol_DoesNotBelongToCompilation() | ||
{ | ||
var source = @"Imports NSubstitute | ||
Namespace MyNamespace | ||
Public Class FooTests | ||
Public Sub Test() | ||
Dim substitute = NSubstitute.Substitute.[For](Of Object)() | ||
Dim x = substitute.ToString().Returns(String.Empty) | ||
End Sub | ||
End Class | ||
End Namespace"; | ||
await VerifyCodeActions(source); | ||
} | ||
|
||
protected override DiagnosticAnalyzer GetDiagnosticAnalyzer() | ||
{ | ||
return new NonSubstitutableMemberAnalyzer(); | ||
} | ||
|
||
protected override CodeFixProvider GetCodeFixProvider() | ||
{ | ||
return new InternalSetupSpecificationCodeFixProvider(); | ||
} | ||
} | ||
} |
Oops, something went wrong.