Exemplo n.º 1
0
        public void PublishWorkspaceChanged_DoesNotSendWorkspaceRefreshRequest_WhenNotSupported()
        {
            // Arrange
            var clientSettings = GetInitializedParams(semanticRefreshEnabled: false);
            var serverClient   = new TestClient(clientSettings);
            var errorReporter  = new TestErrorReporter();

            using var defaultWorkspaceChangedPublisher = new DefaultWorkspaceSemanticTokensRefreshPublisher(serverClient, errorReporter);
            var testAccessor = defaultWorkspaceChangedPublisher.GetTestAccessor();

            // Act
            defaultWorkspaceChangedPublisher.EnqueueWorkspaceSemanticTokensRefresh();
            testAccessor.WaitForEmpty();

            // Assert
            Assert.Equal(0, serverClient.Requests.Count);
        }
Exemplo n.º 2
0
        public void PublishWorkspaceChanged_SendsWorkspaceRefreshRequest_WhenSupported()
        {
            // Arrange
            var clientSettings = GetInitializedParams(semanticRefreshEnabled: true);
            var serverClient   = new TestClient(clientSettings);
            var errorReporter  = new TestErrorReporter();

            using var defaultWorkspaceChangedPublisher = new DefaultWorkspaceSemanticTokensRefreshPublisher(serverClient, errorReporter);
            var testAccessor = defaultWorkspaceChangedPublisher.GetTestAccessor();

            // Act
            defaultWorkspaceChangedPublisher.EnqueueWorkspaceSemanticTokensRefresh();
            testAccessor.WaitForEmpty();

            // Assert
            Assert.Collection(serverClient.Requests,
                              r => Assert.Equal(WorkspaceNames.SemanticTokensRefresh, r.Method));
        }
 internal TestAccessor(DefaultWorkspaceSemanticTokensRefreshPublisher publisher)
 {
     _publisher = publisher;
 }