Example #1
0
        public void IndexOf_NotAnIssuesSnapshot_ReturnsMinusOne()
        {
            var original = new IssuesSnapshot(ValidProjectName, ValidProjectGuid, ValidFilePath, ValidIssueList);

            original.IndexOf(999, Mock.Of <ITableEntriesSnapshot>())
            .Should().Be(IndexOf_NotFoundResult);
        }
Example #2
0
        public void IndexOf_DifferentSnapshotId_ReturnMinusOne()
        {
            var snapshot1 = new IssuesSnapshot(ValidProjectName, ValidProjectGuid, ValidFilePath, ValidIssueList);
            var snapshot2 = new IssuesSnapshot(ValidProjectName, ValidProjectGuid, ValidFilePath, ValidIssueList);

            // Should not be able to map issues between two snapshots with different snapshot ids
            snapshot1.IndexOf(999, snapshot2)
            .Should().Be(IndexOf_NotFoundResult);
        }
Example #3
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);
        }