24
24
using Microsoft . VisualStudio . Shell . TableManager ;
25
25
using Moq ;
26
26
using SonarLint . VisualStudio . IssueVisualization . Models ;
27
- using SonarLint . VisualStudio . TestInfrastructure ;
28
27
29
28
namespace SonarLint . VisualStudio . Infrastructure . VS . UnitTests
30
29
{
@@ -232,21 +231,25 @@ public void TryGetRoslynIssueFromSelectedRow_NoStartColumn_NothingReturned()
232
231
}
233
232
234
233
[ TestMethod ]
235
- [ DataRow ( "S666" , "csharpsquid" , "S666" , "SonarAnalyzer.CSharp" ) ]
236
- [ DataRow ( "S666" , "vbnet" , "S666" , "SonarAnalyzer.VisualBasic" ) ]
237
- [ DataRow ( "S234" , "vbnet" , "S234" , "SonarAnalyzer.VisualBasic" ) ]
238
- [ DataRow ( "c:S111" , "c" , "S111" , "SonarLint" ) ]
239
- [ DataRow ( "cpp:S222" , "cpp" , "S222" , "SonarLint" ) ]
240
- [ DataRow ( "javascript:S333" , "javascript" , "S333" , "SonarLint" ) ]
241
- [ DataRow ( "typescript:S444" , "typescript" , "S444" , "SonarLint" ) ]
242
- [ DataRow ( "secrets:S555" , "secrets" , "S555" , "SonarLint" ) ]
243
- [ DataRow ( "foo:bar" , "foo" , "bar" , "SonarLint" ) ]
244
- public void TryGetRuleIdFromSelectedRow_SingleSonarIssue_ErrorCodeReturned ( string fullRuleKey , string expectedRepo , string expectedRule , string buildTool )
234
+ [ DataRow ( "S666" , "csharpsquid" , "S666" , "SonarAnalyzer.CSharp" , null ) ]
235
+ [ DataRow ( "S666" , "vbnet" , "S666" , "SonarAnalyzer.VisualBasic" , null ) ]
236
+ [ DataRow ( "S234" , "vbnet" , "S234" , "SonarAnalyzer.VisualBasic" , null ) ]
237
+ [ DataRow ( "c:S111" , "c" , "S111" , "SonarLint" , null ) ]
238
+ [ DataRow ( "cpp:S222" , "cpp" , "S222" , "SonarLint" , null ) ]
239
+ [ DataRow ( "javascript:S333" , "javascript" , "S333" , "SonarLint" , null ) ]
240
+ [ DataRow ( "typescript:S444" , "typescript" , "S444" , "SonarLint" , null ) ]
241
+ [ DataRow ( "secrets:S555" , "secrets" , "S555" , "SonarLint" , null ) ]
242
+ [ DataRow ( "foo:bar" , "foo" , "bar" , "SonarLint" , null ) ]
243
+ [ DataRow ( "S666" , "csharpsquid" , "S666" , null , "https://rules.sonarsource.com/csharp/RSPEC-666/" ) ]
244
+ [ DataRow ( "S666" , "vbnet" , "S666" , null , "https://rules.sonarsource.com/vbnet/RSPEC-666/" ) ]
245
+ [ DataRow ( "S234" , "vbnet" , "S234" , null , "https://rules.sonarsource.com/vbnet/RSPEC-234/" ) ]
246
+ public void TryGetRuleIdFromSelectedRow_SingleSonarIssue_ErrorCodeReturned ( string fullRuleKey , string expectedRepo , string expectedRule , string buildTool , string helpLink )
245
247
{
246
248
// Arrange
247
249
var issueHandle = CreateIssueHandle ( 111 , new Dictionary < string , object >
248
250
{
249
251
{ StandardTableKeyNames . BuildTool , buildTool } ,
252
+ { StandardTableKeyNames . HelpLink , helpLink } ,
250
253
{ StandardTableKeyNames . ErrorCode , fullRuleKey }
251
254
} ) ;
252
255
@@ -264,16 +267,19 @@ public void TryGetRuleIdFromSelectedRow_SingleSonarIssue_ErrorCodeReturned(strin
264
267
}
265
268
266
269
[ TestMethod ]
267
- [ DataRow ( "S666" , "csharpsquid" , "S666" , "SonarAnalyzer.CSharp" ) ]
268
- [ DataRow ( "S666" , "vbnet" , "S666" , "SonarAnalyzer.VisualBasic" ) ]
269
- [ DataRow ( "S234" , "vbnet" , "S234" , "SonarAnalyzer.VisualBasic" ) ]
270
- [ DataRow ( "c:S111" , "c" , "S111" , "SonarLint" ) ]
271
- [ DataRow ( "cpp:S222" , "cpp" , "S222" , "SonarLint" ) ]
272
- [ DataRow ( "javascript:S333" , "javascript" , "S333" , "SonarLint" ) ]
273
- [ DataRow ( "typescript:S444" , "typescript" , "S444" , "SonarLint" ) ]
274
- [ DataRow ( "secrets:S555" , "secrets" , "S555" , "SonarLint" ) ]
275
- [ DataRow ( "foo:bar" , "foo" , "bar" , "SonarLint" ) ]
276
- public void TryGetRuleId_FromHandle_ErrorCodeReturned ( string fullRuleKey , string expectedRepo , string expectedRule , string buildTool )
270
+ [ DataRow ( "S666" , "csharpsquid" , "S666" , "SonarAnalyzer.CSharp" , null ) ]
271
+ [ DataRow ( "S666" , "vbnet" , "S666" , "SonarAnalyzer.VisualBasic" , null ) ]
272
+ [ DataRow ( "S234" , "vbnet" , "S234" , "SonarAnalyzer.VisualBasic" , null ) ]
273
+ [ DataRow ( "c:S111" , "c" , "S111" , "SonarLint" , null ) ]
274
+ [ DataRow ( "cpp:S222" , "cpp" , "S222" , "SonarLint" , null ) ]
275
+ [ DataRow ( "javascript:S333" , "javascript" , "S333" , "SonarLint" , null ) ]
276
+ [ DataRow ( "typescript:S444" , "typescript" , "S444" , "SonarLint" , null ) ]
277
+ [ DataRow ( "secrets:S555" , "secrets" , "S555" , "SonarLint" , null ) ]
278
+ [ DataRow ( "foo:bar" , "foo" , "bar" , "SonarLint" , null ) ]
279
+ [ DataRow ( "S666" , "csharpsquid" , "S666" , null , "https://rules.sonarsource.com/csharp/RSPEC-666/" ) ]
280
+ [ DataRow ( "S666" , "vbnet" , "S666" , null , "https://rules.sonarsource.com/vbnet/RSPEC-666/" ) ]
281
+ [ DataRow ( "S234" , "vbnet" , "S234" , null , "https://rules.sonarsource.com/vbnet/RSPEC-234/" ) ]
282
+ public void TryGetRuleId_FromHandle_ErrorCodeReturned ( string fullRuleKey , string expectedRepo , string expectedRule , string buildTool , string helpLink )
277
283
{
278
284
// Note: this is a copy of TryGetRuleIdFromSelectedRow_SingleSonarIssue_ErrorCodeReturned,
279
285
// but without the serviceProvider and IErrorList setup
@@ -282,6 +288,7 @@ public void TryGetRuleId_FromHandle_ErrorCodeReturned(string fullRuleKey, string
282
288
var issueHandle = CreateIssueHandle ( 111 , new Dictionary < string , object >
283
289
{
284
290
{ StandardTableKeyNames . BuildTool , buildTool } ,
291
+ { StandardTableKeyNames . HelpLink , helpLink } ,
285
292
{ StandardTableKeyNames . ErrorCode , fullRuleKey }
286
293
} ) ;
287
294
@@ -366,16 +373,20 @@ public void TryGetRuleIdFromSelectedRow_NotSonarLintIssue()
366
373
}
367
374
368
375
[ TestMethod ]
369
- public void TryGetRuleId_FromHandle_NotSonarLintIssue ( )
376
+ [ DataRow ( "cpp:S333" , "AnotherAnalyzer" , null ) ]
377
+ [ DataRow ( "S666" , "AnotherAnalyzerWithSonarHelpLink" , "https://rules.sonarsource.com/csharp/RSPEC-666/" ) ]
378
+ [ DataRow ( "S234" , "SomeOtherAnalyzer" , "https://rules.sonarsource.com/vbnet/RSPEC-234/" ) ]
379
+ public void TryGetRuleId_FromHandle_NotSonarLintIssue ( string fullRuleKey , object buildTool , string helpLink )
370
380
{
371
381
// Note: this is a copy of TryGetRuleIdFromSelectedRow_SingleSonarIssue_ErrorCodeReturned,
372
382
// but without the serviceProvider and IErrorList setup
373
383
374
384
// Arrange
375
385
var issueHandle = CreateIssueHandle ( 111 , new Dictionary < string , object >
376
386
{
377
- { StandardTableKeyNames . BuildTool , new object ( ) } ,
378
- { StandardTableKeyNames . ErrorCode , "cpp:S333" }
387
+ { StandardTableKeyNames . BuildTool , buildTool } ,
388
+ { StandardTableKeyNames . HelpLink , helpLink } ,
389
+ { StandardTableKeyNames . ErrorCode , fullRuleKey }
379
390
} ) ;
380
391
381
392
// Act
0 commit comments