diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/AttributeTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/AttributeTests.cs
index a39c156d6..fb387eac6 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/AttributeTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/AttributeTests.cs
@@ -22,5 +22,15 @@ public void TestNoDiagnosticAttributeReason()
var attribute = new NoDiagnosticAttribute(reason);
Assert.Same(reason, attribute.Reason);
}
+
+ [Fact]
+ public void TestWorkItemAttribute()
+ {
+ int id = 1234;
+ string issueUri = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2419";
+ var attribute = new WorkItemAttribute(id, issueUri);
+ Assert.Equal(id, attribute.Id);
+ Assert.Same(issueUri, attribute.Location);
+ }
}
}
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj b/StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj
index 8711eb196..8fb8cce44 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj
@@ -410,6 +410,7 @@
+
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/WorkItemAttribute.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/WorkItemAttribute.cs
new file mode 100644
index 000000000..afd1e5dfe
--- /dev/null
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/WorkItemAttribute.cs
@@ -0,0 +1,37 @@
+// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
+// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
+
+namespace StyleCop.Analyzers.Test
+{
+ using System;
+
+ ///
+ /// Used to tag test methods or types which are created for a given WorkItem
+ ///
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
+ public sealed class WorkItemAttribute : Attribute
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The ID of the issue in the original tracker where the work item was first reported. This
+ /// could be a GitHub issue or pull request number, or the number of a Microsoft-internal bug.
+ /// The URI where the work item can be viewed. This is a link to work item
+ /// in the original source.
+ public WorkItemAttribute(int id, string issueUri)
+ {
+ this.Id = id;
+ this.Location = issueUri;
+ }
+
+ public int Id
+ {
+ get;
+ }
+
+ public string Location
+ {
+ get;
+ }
+ }
+}