public void HandleFileRenames_OnlyAnalyzedFileRenamed_SnapshotUpdated() { var location1 = CreateLocation("file1"); var location2 = CreateLocation("file2"); var snapshot = CreateIssuesSnapshot("file3", location1, location2); var renames = new Dictionary <string, string> { { "file3", "new file3" } }; var updatedSnapshot = CreateIssuesSnapshot("new file3"); snapshot.Setup(x => x.CreateUpdatedSnapshot("new file3")).Returns(updatedSnapshot.Object); var testSubject = new IssuesSnapshotFactory(snapshot.Object); var result = testSubject.HandleFileRenames(renames); result.Should().BeTrue(); testSubject.CurrentSnapshot.Should().Be(updatedSnapshot.Object); location1.CurrentFilePath.Should().Be("file1"); location2.CurrentFilePath.Should().Be("file2"); snapshot.Verify(x => x.IncrementVersion(), Times.Never); updatedSnapshot.Verify(x => x.IncrementVersion(), Times.Never); }
public void HandleFileRenames_NoReferencesToToRenamedFile_NoChanges() { var location = CreateLocation("some file1"); var snapshot = CreateIssuesSnapshot("some file2", location); var testSubject = new IssuesSnapshotFactory(snapshot.Object); var result = testSubject.HandleFileRenames(new Dictionary <string, string> { { "old file", "new file" } }); result.Should().BeFalse(); testSubject.CurrentSnapshot.Should().Be(snapshot.Object); location.CurrentFilePath.Should().Be("some file1"); snapshot.Verify(x => x.IncrementVersion(), Times.Never); snapshot.Verify(x => x.CreateUpdatedSnapshot(It.IsAny <string>()), Times.Never); }