Пример #1
0
        public void TryGetFromBuffer_SucceedsIfParserHasCodeDocument()
        {
            // Arrange
            var expectedCodeDocument = TestRazorCodeDocument.Create("Hello World");

#pragma warning disable CS0618 // Type or member is obsolete
            VisualStudioRazorParser parser = new DefaultVisualStudioRazorParser(expectedCodeDocument);
#pragma warning restore CS0618 // Type or member is obsolete
            var properties = new PropertyCollection()
            {
                [typeof(VisualStudioRazorParser)] = parser
            };
            var textBuffer = Mock.Of <ITextBuffer>(buffer => buffer.Properties == properties, MockBehavior.Strict);
            var provider   = new DefaultTextBufferCodeDocumentProvider();

            // Act
            var result = provider.TryGetFromBuffer(textBuffer, out var codeDocument);

            // Assert
            Assert.True(result);
            Assert.Same(expectedCodeDocument, codeDocument);
        }