File tree Expand file tree Collapse file tree
StyleCop.Analyzers/StyleCop.Analyzers.Test Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,5 +22,15 @@ public void TestNoDiagnosticAttributeReason()
2222 var attribute = new NoDiagnosticAttribute ( reason ) ;
2323 Assert . Same ( reason , attribute . Reason ) ;
2424 }
25+
26+ [ Fact ]
27+ public void TestWorkItemAttribute ( )
28+ {
29+ int id = 1234 ;
30+ string issueUri = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2419" ;
31+ var attribute = new WorkItemAttribute ( id , issueUri ) ;
32+ Assert . Equal ( id , attribute . Id ) ;
33+ Assert . Same ( issueUri , attribute . Location ) ;
34+ }
2535 }
2636}
Original file line number Diff line number Diff line change 410410 <Compile Include =" SpecialRules\SA0002UnitTests.cs" />
411411 <Compile Include =" Verifiers\CodeFixVerifier.cs" />
412412 <Compile Include =" Verifiers\DiagnosticVerifier.cs" />
413+ <Compile Include =" WorkItemAttribute.cs" />
413414 </ItemGroup >
414415 <ItemGroup >
415416 <None Include =" ..\..\build\keys\TestingKey.snk" >
Original file line number Diff line number Diff line change 1+ // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2+ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3+
4+ namespace StyleCop . Analyzers . Test
5+ {
6+ using System ;
7+
8+ /// <summary>
9+ /// Used to tag test methods or types which are created for a given WorkItem
10+ /// </summary>
11+ [ AttributeUsage ( AttributeTargets . Class | AttributeTargets . Method , AllowMultiple = true ) ]
12+ public sealed class WorkItemAttribute : Attribute
13+ {
14+ /// <summary>
15+ /// Initializes a new instance of the <see cref="WorkItemAttribute"/> class.
16+ /// </summary>
17+ /// <param name="id">The ID of the issue in the original tracker where the work item was first reported. This
18+ /// could be a GitHub issue or pull request number, or the number of a Microsoft-internal bug.</param>
19+ /// <param name="issueUri">The URI where the work item can be viewed. This is a link to work item
20+ /// <paramref name="id"/> in the original source.</param>
21+ public WorkItemAttribute ( int id , string issueUri )
22+ {
23+ this . Id = id ;
24+ this . Location = issueUri ;
25+ }
26+
27+ public int Id
28+ {
29+ get ;
30+ }
31+
32+ public string Location
33+ {
34+ get ;
35+ }
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments