예제 #1
0
        public void CreateCompletionSource_CreatesACompletionSourceWithTextBuffersParser()
        {
            // Arrange
            var razorBuffer = Mock.Of <ITextBuffer>(buffer => buffer.ContentType == RazorContentType && buffer.Properties == new PropertyCollection(), MockBehavior.Strict);
            var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(CompletionFactsService);

            // Act
            var completionSource = completionSourceProvider.CreateCompletionSource(razorBuffer);

            // Assert
            Assert.Null(completionSource);
        }
예제 #2
0
        public void CreateCompletionSource_ReturnsNullIfParserHasNotBeenAssocitedWithRazorBuffer()
        {
            // Arrange
            var expectedParser = Mock.Of <VisualStudioRazorParser>(MockBehavior.Strict);
            var properties     = new PropertyCollection();

            properties.AddProperty(typeof(VisualStudioRazorParser), expectedParser);
            var razorBuffer = Mock.Of <ITextBuffer>(buffer => buffer.ContentType == RazorContentType && buffer.Properties == properties, MockBehavior.Strict);
            var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(CompletionFactsService);

            // Act
            var completionSource = completionSourceProvider.CreateCompletionSource(razorBuffer);

            // Assert
            var completionSourceImpl = Assert.IsType <RazorDirectiveCompletionSource>(completionSource);

            Assert.Same(expectedParser, completionSourceImpl.Parser);
        }