public void FxCopConverter_CreateIssue_FakeContext_NoModule_Resource() { var context = TestHelper.CreateProjectContext(); context.RefineTarget(@"mybinary.dll"); context.RefineResource("myresource.resx"); context.RefineMessage("CA0000", "VeryUsefulCheck", null, null, null); context.RefineIssue("hello!", "test", null, null, null, null, null); Assert.AreEqual(@"myresource.resx", FxCopConverter.CreateIssue(context).Locations[0].FullyQualifiedLogicalName); }
public void FxCopConverter_CreateIssue_FakeContext_Resource() { var context = TestHelper.CreateProjectContext(); context.RefineTarget(@"mybinary.dll"); context.RefineModule("mybinary.dll"); context.RefineResource("myresource.resx"); context.RefineMessage("CA0000", "VeryUsefulCheck", null, null, null); context.RefineIssue("hello!", "test", null, null, @"source", "myfile.cs", 13); FxCopConverter.CreateIssue(context).Locations.Should().Equal(new[] { new Location { AnalysisTarget = new[] { new PhysicalLocationComponent { Uri = new Uri("mybinary.dll", UriKind.RelativeOrAbsolute), MimeType = MimeType.Binary } }, ResultFile = new[] { new PhysicalLocationComponent { Uri = new Uri("source\\myfile.cs", UriKind.RelativeOrAbsolute), MimeType = MimeType.CSharp, Region = new Region { StartLine = 13 } } }, FullyQualifiedLogicalName = "myresource.resx", LogicalLocation = new[] { new LogicalLocationComponent { Name = "mybinary.dll", Kind = LogicalLocationKind.ClrModule }, new LogicalLocationComponent { Name = "myresource.resx", Kind = LogicalLocationKind.ClrResource } } } }); }
public void FxCopConverter_CreateIssue_FakeContext_NoModule_Member() { var context = TestHelper.CreateProjectContext(); context.RefineTarget(@"mybinary.dll"); context.RefineNamespace("mynamespace"); context.RefineType("mytype"); context.RefineMember("mymember(string)"); context.RefineMessage("CA0000", "VeryUsefulCheck", null, null, null); context.RefineIssue("hello!", null, null, null, null, null, null); FxCopConverter.CreateIssue(context).Locations.Should().Equal( new[] { new Location { AnalysisTarget = new[] { new PhysicalLocationComponent { Uri = new Uri("mybinary.dll", UriKind.RelativeOrAbsolute), MimeType = MimeType.Binary } }, FullyQualifiedLogicalName = "mynamespace.mytype.mymember(string)", LogicalLocation = new[] { new LogicalLocationComponent { Name = "mynamespace", Kind = LogicalLocationKind.ClrNamespace }, new LogicalLocationComponent { Name = "mytype", Kind = LogicalLocationKind.ClrType }, new LogicalLocationComponent { Name = "mymember(string)", Kind = LogicalLocationKind.ClrFunction } } } }); }
public void FxCopConverter_CreateIssue_FakeContext_Member() { var context = TestHelper.CreateProjectContext(); context.RefineTarget(@"mybinary.dll"); context.RefineModule("mybinary.dll"); context.RefineNamespace("mynamespace"); context.RefineType("mytype"); context.RefineMember("mymember(string)"); context.RefineMessage("CA0000", "VeryUsefulCheck", "1", "FakeCategory", "Breaking"); context.RefineIssue("hello!", "test", "uncertain", "error", @"source", "myfile.cs", 13); Assert.AreEqual(new Result { RuleId = "CA0000", ShortMessage = "VeryUsefulCheck", FullMessage = "hello!", ToolFingerprint = "1#test", Locations = new[] { new Location { AnalysisTarget = new[] { new PhysicalLocationComponent { Uri = new Uri("mybinary.dll", UriKind.RelativeOrAbsolute), MimeType = MimeType.Binary } }, ResultFile = new[] { new PhysicalLocationComponent { Uri = new Uri("source\\myfile.cs", UriKind.RelativeOrAbsolute), MimeType = MimeType.CSharp, Region = new Region { StartLine = 13 } } }, FullyQualifiedLogicalName = "mynamespace.mytype.mymember(string)", LogicalLocation = new[] { new LogicalLocationComponent { Name = "mybinary.dll", Kind = LogicalLocationKind.ClrModule }, new LogicalLocationComponent { Name = "mynamespace", Kind = LogicalLocationKind.ClrNamespace }, new LogicalLocationComponent { Name = "mytype", Kind = LogicalLocationKind.ClrType }, new LogicalLocationComponent { Name = "mymember(string)", Kind = LogicalLocationKind.ClrFunction } } } }, Properties = new Dictionary <string, string> { { "Level", "error" }, { "Category", "FakeCategory" }, { "FixCategory", "Breaking" } } }, FxCopConverter.CreateIssue(context)); }