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

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

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

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

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

            // Assert
            Assert.Null(completionSource);
        }