public RefineIssue ( string message, string result, string certainty, string level, string path, string file, int line ) : void | ||
message | string | |
result | string | |
certainty | string | |
level | string | |
path | string | |
file | string | |
line | int | |
리턴 | void |
public void FxCopConverter_CreateResult_FakeContext_Resource() { FxCopLogReader.Context context = TestHelper.CreateProjectContext(); context.RefineTarget(@"mybinary.dll"); context.RefineModule("mybinary.dll"); context.RefineResource("myresource.resx"); context.RefineMessage("CA0000", "VeryUsefulCheck", null, null, null, null); context.RefineIssue("hello!", "test", null, null, @"source", "myfile.cs", 13); var expectedLogicalLocations = new List <LogicalLocation> { new LogicalLocation { Kind = LogicalLocationKind.Module, Name = "mybinary.dll" }, new LogicalLocation { ParentIndex = 0, Name = "myresource.resx", FullyQualifiedName = "mybinary.dll!myresource.resx", Kind = LogicalLocationKind.Resource } }; var converter = new FxCopConverter(); Result result = converter.CreateResult(context); ValidateLogicalLocations(expectedLogicalLocations, converter.LogicalLocations); }
public void FxCopConverter_CreateResult_FakeContext_NoModule_Member() { FxCopLogReader.Context context = TestHelper.CreateProjectContext(); context.RefineTarget(@"mybinary.dll"); context.RefineNamespace("mynamespace"); context.RefineType("mytype"); context.RefineMember("mymember(string)"); context.RefineMessage("CA0000", "VeryUsefulCheck", null, null, null, null); context.RefineIssue("hello!", null, null, null, null, null, null); var expectedLogicalLocations = new List <LogicalLocation> { new LogicalLocation { ParentIndex = -1, Name = "mynamespace", Kind = LogicalLocationKind.Namespace }, new LogicalLocation { ParentIndex = 0, Name = "mytype", FullyQualifiedName = "mynamespace.mytype", Kind = LogicalLocationKind.Type }, new LogicalLocation { ParentIndex = 1, Name = "mymember(string)", FullyQualifiedName = "mynamespace.mytype.mymember(string)", Kind = LogicalLocationKind.Member } }; var converter = new FxCopConverter(); Result result = converter.CreateResult(context); ValidateLogicalLocations(expectedLogicalLocations, converter.LogicalLocations); }
public void FxCopLogReader_Context_RefineIssue() { FxCopLogReader.Context context = TestHelper.CreateProjectContext(); context.RefineIssue("hello!", "test", "25", "error", "source", "myfile.cs", 13); Assert.Equal("hello!", context.Message); Assert.Equal("test", context.ResolutionName); Assert.Equal("25", context.Certainty); Assert.Equal("error", context.Level); Assert.Equal("source", context.Path); Assert.Equal("myfile.cs", context.File); Assert.Equal(13, context.Line.Value); }
public void FxCopConverter_CreateResult_FakeContext_NoModule_Resource() { FxCopLogReader.Context context = TestHelper.CreateProjectContext(); context.RefineTarget(@"mybinary.dll"); context.RefineResource("myresource.resx"); context.RefineMessage("CA0000", "VeryUsefulCheck", null, null, null, null); context.RefineIssue("hello!", "test", null, null, null, null, null); var converter = new FxCopConverter(); Result result = converter.CreateResult(context); result.Locations.First().LogicalLocation.FullyQualifiedName.Should().Be(@"myresource.resx"); }
public void FxCopLogReader_Context_RefineProjectToMemberIssue() { FxCopLogReader.Context 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", "MyCategory", "Breaking", "Excluded"); context.RefineIssue("hello!", "test", "25", "error", "source", "myfile.cs", 13); Assert.Equal("mybinary.dll", context.Target); Assert.Equal("mybinary.dll", context.Module); Assert.Equal("mynamespace", context.Namespace); Assert.Equal("mytype", context.Type); Assert.Equal("mymember(string)", context.Member); Assert.Equal("CA0000", context.CheckId); Assert.Equal("1", context.MessageId); Assert.Equal("MyCategory", context.Category); Assert.Equal("VeryUsefulCheck", context.Typename); Assert.Equal("Breaking", context.FixCategory); Assert.Equal("hello!", context.Message); Assert.Equal("test", context.ResolutionName); Assert.Equal("25", context.Certainty); Assert.Equal("error", context.Level); Assert.Equal("source", context.Path); Assert.Equal("myfile.cs", context.File); Assert.Equal("Excluded", context.Status); Assert.Equal(13, context.Line.Value); context.ClearTarget(); Assert.Null(context.Target); Assert.Null(context.Module); Assert.Null(context.Namespace); Assert.Null(context.Type); Assert.Null(context.Member); Assert.Null(context.Message); Assert.Null(context.ResolutionName); }
public void FxCopLogReader_Context_RefineProjectToExceptionIssue() { FxCopLogReader.Context context = TestHelper.CreateProjectContext(); context.RefineException(true, "CA0001", "binary.dll#namespace#member(string)"); context.RefineExceptionType("type"); context.RefineExceptionMessage("message"); context.RefineStackTrace("trace"); context.RefineInnerExceptionType("innertype"); context.RefineInnerExceptionMessage("innermessage"); context.RefineInnerStackTrace("innertrace"); string exception = FxCopLogReader.MakeExceptionMessage("Rule", "CA1000", context.ExceptionType, context.ExceptionMessage, context.StackTrace, context.InnerExceptionType, context.InnerExceptionMessage, context.InnerStackTrace); context.RefineIssue(exception, null, null, null, null, null, null); Assert.Equal("Rule CA1000 exception: type: message trace. Inner Exception: innertype: innermessage innertrace", context.Message); Assert.Equal("binary.dll#namespace#member(string)", context.ExceptionTarget); context.ClearException(); Assert.Null(context.Target); Assert.Null(context.Module); Assert.Null(context.Namespace); Assert.Null(context.Type); Assert.Null(context.Member); Assert.Null(context.Message); Assert.Null(context.ResolutionName); Assert.False(context.Exception); Assert.Null(context.ExceptionType); Assert.Null(context.ExceptionMessage); Assert.Null(context.StackTrace); Assert.Null(context.InnerExceptionType); Assert.Null(context.InnerExceptionMessage); Assert.Null(context.InnerStackTrace); }
public void FxCopConverter_CreateResult_FakeContext_Member() { FxCopLogReader.Context 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", "ExcludedInSource"); context.RefineIssue(null, "test", "uncertain", "error", @"source", "myfile.cs", 13); context.RefineItem("hello!"); string expectedLogicalLocation = "mynamespace.mytype.mymember(string)"; var expectedResult = new Result { RuleId = "CA0000", Message = new Message { Arguments = new List <string>(new string[] { "hello!" }) }, Suppressions = new List <Suppression> { new Suppression { Kind = SuppressionKind.InSource } }, PartialFingerprints = new Dictionary <string, string>(), AnalysisTarget = new ArtifactLocation { Uri = new Uri("mybinary.dll", UriKind.RelativeOrAbsolute), }, Locations = new List <Location> { new Location { PhysicalLocation = new PhysicalLocation { ArtifactLocation = new ArtifactLocation { Uri = new Uri("source\\myfile.cs", UriKind.RelativeOrAbsolute) }, Region = new Region { StartLine = 13 } }, LogicalLocation = new LogicalLocation { FullyQualifiedName = expectedLogicalLocation, Index = 3 } } } }; expectedResult.PartialFingerprints.Add("UniqueId", "1#test"); expectedResult.SetProperty("Level", "error"); expectedResult.SetProperty("Category", "FakeCategory"); expectedResult.SetProperty("FixCategory", "Breaking"); var expectedLogicalLocations = new List <LogicalLocation> { new LogicalLocation { ParentIndex = -1, Name = "mybinary.dll", Kind = LogicalLocationKind.Module }, new LogicalLocation { ParentIndex = 0, Name = "mynamespace", FullyQualifiedName = "mybinary.dll!mynamespace", Kind = LogicalLocationKind.Namespace }, new LogicalLocation { ParentIndex = 1, Name = "mytype", FullyQualifiedName = "mybinary.dll!mynamespace.mytype", Kind = LogicalLocationKind.Type }, new LogicalLocation { ParentIndex = 2, Name = "mymember(string)", FullyQualifiedName = "mybinary.dll!mynamespace.mytype.mymember(string)", Kind = LogicalLocationKind.Member } }; var converter = new FxCopConverter(); Result result = converter.CreateResult(context); ValidateLogicalLocations(expectedLogicalLocations, converter.LogicalLocations); }