Example #1
0
        public void IndexOf_SameSnapshotId_ReturnExpectedIndex()
        {
            var original = new IssuesSnapshot(ValidProjectName, ValidProjectGuid, ValidFilePath, ValidIssueList);
            var revised  = original.CreateUpdatedSnapshot("unimportant change");

            // Should be able to map issues between two snapshots with the same snapshot id
            original.IndexOf(999, revised)
            .Should().Be(999);
        }
        public void IndexOf_IfIndexOutOfRange_ReturnsNotFound(int inputIndex, int expected)
        {
            var original = new IssuesSnapshot(ValidProjectName, ValidProjectGuid, ValidFilePath,
                                              new[] { CreateIssue(), CreateIssue(), CreateIssue() });
            var modified = original.CreateUpdatedSnapshot("unimportant change");

            // Should not be able to map to an out-of-range index
            original.IndexOf(inputIndex, modified)
            .Should().Be(expected);
        }
        public void IndexOf_NewIssueDoesNotHaveValidSpan_ReturnNotFound()
        {
            var span      = CreateIssue();
            var snapshot1 = new IssuesSnapshot(ValidProjectName, ValidProjectGuid, ValidFilePath, new[] { span });
            var snapshot2 = snapshot1.CreateUpdatedSnapshot("unimportant change");

            span.InvalidateSpan();

            // Should not be able to map to an issue with an invalid span since it should be hidden
            snapshot1.IndexOf(0, snapshot2)
            .Should().Be(IndexOf_NotFoundResult);
        }
Example #4
0
        public void Construction_UpdateFilePath_PreservesIdAndUpdatesVersion()
        {
            var original = new IssuesSnapshot(ValidProjectName, ValidProjectGuid, ValidFilePath, ValidIssueList);
            var revised  = original.CreateUpdatedSnapshot("new path");

            revised.AnalysisRunId.Should().Be(original.AnalysisRunId);
            revised.VersionNumber.Should().BeGreaterThan(original.VersionNumber);
            GetFilePath(original).Should().Be(ValidFilePath);
            GetFilePath(revised).Should().Be("new path");

            // Other properties
            revised.Issues.Should().BeEquivalentTo(original.Issues);
            GetProjectName(revised).Should().Be(GetProjectName(original));
            GetProjectGuid(revised).Should().Be(GetProjectGuid(original));
        }