public void MarkAsLatestVersion_KnownDocument_TracksNewDocumentAsLatest() { // Arrange var documentVersionCache = new DefaultDocumentVersionCache(Dispatcher); var documentInitial = TestDocumentSnapshot.Create("C:/file.cshtml"); documentVersionCache.TrackDocumentVersion(documentInitial, 123); var documentLatest = TestDocumentSnapshot.Create(documentInitial.FilePath); // Act documentVersionCache.MarkAsLatestVersion(documentLatest); // Assert Assert.True(documentVersionCache.TryGetDocumentVersion(documentLatest, out var version)); Assert.Equal(123, version); }
public void MarkAsLatestVersion_UntrackedDocument_Noops() { // Arrange var documentVersionCache = new DefaultDocumentVersionCache(Dispatcher); var document = TestDocumentSnapshot.Create("C:/file.cshtml"); documentVersionCache.TrackDocumentVersion(document, 123); var untrackedDocument = TestDocumentSnapshot.Create("C:/other.cshtml"); // Act documentVersionCache.MarkAsLatestVersion(untrackedDocument); // Assert Assert.False(documentVersionCache.TryGetDocumentVersion(untrackedDocument, out var version)); Assert.Null(version); }