Beispiel #1
0
        public void SyntaxTreeRequest_Cancel_CanBeCalledMultipleTimes()
        {
            // Arrange
            var request = new DefaultVisualStudioRazorParser.SyntaxTreeRequest(StringTextSnapshot.Empty, CancellationToken.None);

            // Act & Assert
            request.Cancel();
            request.Cancel();
            request.Cancel();
        }
Beispiel #2
0
        public void SyntaxTreeRequest_Cancel_CancelsTask()
        {
            // Arrange
            var request = new DefaultVisualStudioRazorParser.SyntaxTreeRequest(StringTextSnapshot.Empty, CancellationToken.None);

            // Act
            request.Cancel();

            // Assert
            Assert.True(request.Task.IsCanceled);
        }
Beispiel #3
0
        public void SyntaxTreeRequest_CancelToCompleteNoops()
        {
            // Arrange
            var syntaxTree = RazorSyntaxTree.Parse(TestRazorSourceDocument.Create());
            var request    = new DefaultVisualStudioRazorParser.SyntaxTreeRequest(StringTextSnapshot.Empty, CancellationToken.None);

            // Act - 1
            request.Cancel();

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

            // Act & Assert - 2
            request.Complete(syntaxTree);
        }