public void DelegatedSuppressDocument_KnownAndUpdatedDocument_TriggersUpdate() { // Arrange var provider = new RazorDynamicDocumentInfoProvider(Factory, InnerDynamicDocumentInfoProvider); DocumentInfo documentInfo = null; provider.Updated += (info) => { documentInfo = info; }; // Populate the providers understanding of our project/document provider.GetDynamicDocumentInfo(ProjectId.CreateNewId(), ProjectSnapshot.FilePath, DocumentSnapshot.FilePath); var documentContainer = new DefaultDynamicDocumentContainer(DocumentSnapshot); // Update the document with content InnerDynamicDocumentInfoProvider.UpdateFileInfo(ProjectSnapshot.FilePath, documentContainer); // Act InnerDynamicDocumentInfoProvider.SuppressDocument(ProjectSnapshot.FilePath, DocumentSnapshot.FilePath); // Assert Assert.NotNull(documentInfo); Assert.Equal(DocumentSnapshot.FilePath, documentInfo.FilePath); }
public void DelegatedUpdateFileInfo_UnknownDocument_Noops() { // Arrange var provider = new RazorDynamicDocumentInfoProvider(Factory, InnerDynamicDocumentInfoProvider); provider.Updated += (_) => throw new XunitException("This should not have been called."); var documentContainer = new DefaultDynamicDocumentContainer(DocumentSnapshot); // Act & Assert InnerDynamicDocumentInfoProvider.UpdateFileInfo(ProjectSnapshot.FilePath, documentContainer); }
public void DelegatedSuppressDocument_KnownDocument_NotUpdated_Noops() { // Arrange var provider = new RazorDynamicDocumentInfoProvider(Factory, InnerDynamicDocumentInfoProvider); provider.Updated += (_) => throw new XunitException("This should not have been called."); // Populate the providers understanding of our project/document provider.GetDynamicDocumentInfo(ProjectId.CreateNewId(), ProjectSnapshot.FilePath, DocumentSnapshot.FilePath); var documentContainer = new DefaultDynamicDocumentContainer(DocumentSnapshot); // Act & Assert InnerDynamicDocumentInfoProvider.SuppressDocument(ProjectSnapshot.FilePath, DocumentSnapshot.FilePath); }
public void DelegatedRemoveDynamicDocumentInfo_UntracksDocument() { // Arrange var provider = new RazorDynamicDocumentInfoProvider(Factory, InnerDynamicDocumentInfoProvider); // Populate the providers understanding of our project/document provider.GetDynamicDocumentInfo(ProjectId.CreateNewId(), ProjectSnapshot.FilePath, DocumentSnapshot.FilePath); var documentContainer = new DefaultDynamicDocumentContainer(DocumentSnapshot); // Update the document with content InnerDynamicDocumentInfoProvider.UpdateFileInfo(ProjectSnapshot.FilePath, documentContainer); // Now explode if any further updates happen provider.Updated += (_) => throw new XunitException("This should not have been called."); // Act provider.RemoveDynamicDocumentInfo(ProjectId.CreateNewId(), ProjectSnapshot.FilePath, DocumentSnapshot.FilePath); // Assert this should not update InnerDynamicDocumentInfoProvider.UpdateFileInfo(ProjectSnapshot.FilePath, documentContainer); }