Esempio n. 1
0
        public void GetOrCreate_CachesCompletionSource()
        {
            // Arrange
            var expectedParser = Mock.Of <VisualStudioRazorParser>(MockBehavior.Strict);
            var properties     = new PropertyCollection();

            properties.AddProperty(typeof(VisualStudioRazorParser), expectedParser);
            var textView = CreateTextView(RazorContentType, properties);
            var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(CompletionFactsService);

            // Act
            var completionSource1 = completionSourceProvider.GetOrCreate(textView);
            var completionSource2 = completionSourceProvider.GetOrCreate(textView);

            // Assert
            Assert.Same(completionSource1, completionSource2);
        }
Esempio n. 2
0
        public void GetOrCreate_ReturnsNullIfRazorBufferHasNotBeenAssociatedWithTextView()
        {
            // Arrange
            var textView = CreateTextView(NonRazorContentType, new PropertyCollection());
            var completionSourceProvider = new RazorDirectiveCompletionSourceProvider(CompletionFactsService);

            // Act
            var completionSource = completionSourceProvider.GetOrCreate(textView);

            // Assert
            Assert.Null(completionSource);
        }