public void CodeDocumentRequest_Complete_CanBeCalledMultipleTimes()
        {
            // Arrange
            var codeDocument = RazorCodeDocument.Create(TestRazorSourceDocument.Create());
            var request      = new DefaultVisualStudioRazorParser.CodeDocumentRequest(StringTextSnapshot.Empty, CancellationToken.None);

            // Act & Assert
            request.Complete(codeDocument);
            request.Complete(codeDocument);
            request.Complete(codeDocument);
        }
        public void CodeDocumentRequest_CancelToCompleteNoops()
        {
            // Arrange
            var codeDocument = RazorCodeDocument.Create(TestRazorSourceDocument.Create());
            var request      = new DefaultVisualStudioRazorParser.CodeDocumentRequest(StringTextSnapshot.Empty, CancellationToken.None);

            // Act - 1
            request.Cancel();

            // Assert - 1
            Assert.True(request.Task.IsCanceled);

            // Act & Assert - 2
            request.Complete(codeDocument);
        }
        public async Task CodeDocumentRequest_Complete_FinishesTask()
        {
            // Arrange
            var codeDocument = RazorCodeDocument.Create(TestRazorSourceDocument.Create());
            var request      = new DefaultVisualStudioRazorParser.CodeDocumentRequest(StringTextSnapshot.Empty, CancellationToken.None);

            // Act
            request.Complete(codeDocument);

            // Assert
            Assert.True(request.Task.IsCompleted);
            var resolvedSyntaxTree = await request.Task;

            Assert.Same(codeDocument, resolvedSyntaxTree);
        }