private RazorLanguageService CreateLanguageServiceWith(
            RazorBreakpointResolver breakpointResolver = null,
            RazorProximityExpressionResolver proximityExpressionResolver = null,
            WaitDialogFactory waitDialogFactory = null,
            IVsEditorAdaptersFactoryService editorAdaptersFactory = null)
        {
            if (breakpointResolver is null)
            {
                breakpointResolver = new Mock <RazorBreakpointResolver>(MockBehavior.Strict).Object;
                Mock.Get(breakpointResolver).Setup(r => r.TryResolveBreakpointRangeAsync(It.IsAny <ITextBuffer>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <CancellationToken>())).ReturnsAsync(value: null);
            }

            if (proximityExpressionResolver is null)
            {
                proximityExpressionResolver = new Mock <RazorProximityExpressionResolver>(MockBehavior.Strict).Object;
                Mock.Get(proximityExpressionResolver).Setup(r => r.TryResolveProximityExpressionsAsync(It.IsAny <ITextBuffer>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <CancellationToken>())).ReturnsAsync(value: null);
            }

            waitDialogFactory ??= new TestWaitDialogFactory();
            editorAdaptersFactory ??= Mock.Of <IVsEditorAdaptersFactoryService>(service => service.GetDataBuffer(It.IsAny <IVsTextBuffer>()) == new TestTextBuffer(new StringTextSnapshot(Environment.NewLine)), MockBehavior.Strict);

            var languageService = new RazorLanguageService(breakpointResolver, proximityExpressionResolver, waitDialogFactory, editorAdaptersFactory);

            return(languageService);
        }
예제 #2
0
        private RazorLanguageService CreateLanguageServiceWith(
            RazorBreakpointResolver breakpointResolver            = null,
            WaitDialogFactory waitDialogFactory                   = null,
            IVsEditorAdaptersFactoryService editorAdaptersFactory = null)
        {
            breakpointResolver ??= Mock.Of <RazorBreakpointResolver>();
            waitDialogFactory ??= new TestWaitDialogFactory();
            editorAdaptersFactory ??= Mock.Of <IVsEditorAdaptersFactoryService>(service => service.GetDataBuffer(It.IsAny <IVsTextBuffer>()) == new TestTextBuffer(new StringTextSnapshot(Environment.NewLine)));

            var languageService = new RazorLanguageService(breakpointResolver, waitDialogFactory, editorAdaptersFactory);

            return(languageService);
        }