public void UpdateIndicesFromLegacyDataVisitor_FunctionsWithNullMaps() { var result = _result.DeepClone(); var visitor = new UpdateIndicesFromLegacyDataVisitor(null, null, null); visitor.VisitResult(result); result.Locations[0].LogicalLocation.Index.Should().Be(Int32.MaxValue); result.Locations[0].PhysicalLocation.ArtifactLocation.Index.Should().Be(Int32.MaxValue); }
public void UpdateIndicesFromLegacyDataVisitor_RemapsFullyQualifiedogicalLNames() { var result = _result.DeepClone(); int remappedIndex = 42; var fullyQualifiedLogicalNameToIndexMap = new Dictionary <string, int> { [_remappedFullyQualifiedLogicalName] = remappedIndex }; var visitor = new UpdateIndicesFromLegacyDataVisitor(fullyQualifiedLogicalNameToIndexMap, fileLocationKeyToIndexMap: null, ruleKeyToIndexMap: null); visitor.VisitResult(result); result.Locations[0].LogicalLocation.Index.Should().Be(remappedIndex); result.Locations[0].PhysicalLocation.ArtifactLocation.Index.Should().Be(Int32.MaxValue); }
public void UpdateIndicesFromLegacyDataVisitor_DoesNotMutateUnrecognizedFileLocation() { var result = ConstructNewResult(); Result originalResult = result.DeepClone(); int remappedIndex = 42 * 2; var fileLocationKeyToIndexMap = new Dictionary <string, int>() { ["#" + _remappedUriBaseId + "#" + _remappedUri] = remappedIndex }; var visitor = new UpdateIndicesFromLegacyDataVisitor(fullyQualifiedLogicalNameToIndexMap: null, fileLocationKeyToIndexMap: fileLocationKeyToIndexMap, null); visitor.VisitResult(result); result.ValueEquals(originalResult).Should().BeTrue(); }
public void UpdateIndicesFromLegacyDataVisitor_DoesNotMutateUnrecognizedLogicalLocation() { Result result = ConstructNewResult(); Result originalResult = result.DeepClone(); int remappedIndex = 42 * 3; var fullyQualifiedLogicalNameToIndexMap = new Dictionary <string, int> { [_remappedFullyQualifiedLogicalName] = remappedIndex }; var visitor = new UpdateIndicesFromLegacyDataVisitor(fullyQualifiedLogicalNameToIndexMap, null, null); visitor.VisitResult(result); result.ValueEquals(originalResult).Should().BeTrue(); }
public void UpdateIndicesFromLegacyDataVisitor_RemapsFileLocations() { var result = _result.DeepClone(); int remappedIndex = 42 * 42; ArtifactLocation fileLocation = result.Locations[0].PhysicalLocation.ArtifactLocation; var fileLocationKeyToIndexMap = new Dictionary <string, int>() { ["#" + fileLocation.UriBaseId + "#" + fileLocation.Uri.OriginalString] = remappedIndex }; var visitor = new UpdateIndicesFromLegacyDataVisitor(fullyQualifiedLogicalNameToIndexMap: null, fileLocationKeyToIndexMap: fileLocationKeyToIndexMap, ruleKeyToIndexMap: null); visitor.VisitResult(result); result.Locations[0].LogicalLocation.Index.Should().Be(Int32.MaxValue); result.Locations[0].PhysicalLocation.ArtifactLocation.Index.Should().Be(remappedIndex); }
public void UpdateIndicesFromLegacyDataVisitor_RemapsRuleIds() { int remappedIndex = 0; string actualRuleId = "ActualId"; var ruleKeyToIndexMap = new Dictionary <string, int>() { ["COLLISION"] = remappedIndex }; var result = _result.DeepClone(); result.RuleId = "COLLISION"; result.RuleIndex = -1; var run = new Run { Tool = new Tool { Driver = new ToolComponent { Rules = new List <ReportingDescriptor> { new ReportingDescriptor { Id = actualRuleId } } } }, Results = new List <Result> { result } }; var visitor = new UpdateIndicesFromLegacyDataVisitor(fullyQualifiedLogicalNameToIndexMap: null, fileLocationKeyToIndexMap: null, ruleKeyToIndexMap: ruleKeyToIndexMap); visitor.VisitRun(run); result.RuleId.Should().Be(actualRuleId); result.RuleIndex.Should().Be(remappedIndex); }