示例#1
0
        public void Publish_PublishesToSetPublishFilePath()
        {
            // Arrange
            var serializationSuccessful       = false;
            var omniSharpProjectSnapshot      = CreateProjectSnapshot(@"C:\path\to\project.csproj");
            var expectedConfigurationFilePath = @"C:\path\to\obj\bin\Debug\project.razor.json";
            var publisher = new TestProjectRazorJsonPublisher(
                ProjectConfigurationFilePathStore,
                onSerializeToFile: (snapshot, configurationFilePath) =>
            {
                Assert.Same(omniSharpProjectSnapshot, snapshot);
                Assert.Equal(expectedConfigurationFilePath, configurationFilePath);
                serializationSuccessful = true;
            })
            {
                _active = true,
            };

            publisher.Initialize(ProjectSnapshotManager);
            ProjectConfigurationFilePathStore.Set(omniSharpProjectSnapshot.FilePath, expectedConfigurationFilePath);

            // Act
            publisher.Publish(omniSharpProjectSnapshot);

            // Assert
            Assert.True(serializationSuccessful);
        }
示例#2
0
        public void Publish_UnsetConfigurationFilePath_Noops()
        {
            // Arrange
            var publisher = new TestProjectRazorJsonPublisher(
                ProjectConfigurationFilePathStore)
            {
                _active = true,
            };

            publisher.Initialize(ProjectSnapshotManager);
            var omniSharpProjectSnapshot = CreateProjectSnapshot(@"C:\path\to\project.csproj");

            // Act & Assert
            publisher.Publish(omniSharpProjectSnapshot);
        }