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);
        }