当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript TestInstantiationService.stub方法代码示例

本文整理汇总了TypeScript中vs/platform/instantiation/test/common/instantiationServiceMock.TestInstantiationService.stub方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TestInstantiationService.stub方法的具体用法?TypeScript TestInstantiationService.stub怎么用?TypeScript TestInstantiationService.stub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vs/platform/instantiation/test/common/instantiationServiceMock.TestInstantiationService的用法示例。


在下文中一共展示了TestInstantiationService.stub方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: setup

	setup(() => {
		storageData = {};
		instantiationService.stub(IStorageService, {
			get: (a, b, c) => a === 'experiments.experiment1' ? JSON.stringify(storageData) : c,
			store: (a, b, c) => {
				if (a === 'experiments.experiment1') {
					storageData = JSON.parse(b);
				}
			}
		});
		instantiationService.stub(INotificationService, new TestNotificationService());
		experimentService = instantiationService.createInstance(TestExperimentService);
		experimentService.onExperimentEnabled = onExperimentEnabledEvent.event;
		instantiationService.stub(IExperimentService, experimentService);
	});
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:15,代码来源:experimentalPrompts.test.ts

示例2: test

	test('TextDiffEditorModel', function (done) {
		instantiationService.stub(IModelService, stubModelService(instantiationService));
		let input = instantiationService.createInstance(StringEditorInput, 'name', 'description', 'value', 'text/plain', false);
		let otherInput = instantiationService.createInstance(StringEditorInput, 'name2', 'description', 'value2', 'text/plain', false);
		let diffInput = new DiffEditorInput('name', 'description', input, otherInput);

		diffInput.resolve(true).then((model: any) => {
			assert(model);
			assert(model instanceof TextDiffEditorModel);

			let diffEditorModel = model.textDiffEditorModel;
			assert(diffEditorModel.original);
			assert(diffEditorModel.modified);

			return diffInput.resolve(true).then((model: any) => {
				assert(model.isResolved());

				assert(diffEditorModel !== model.textDiffEditorModel);
				diffInput.dispose();
				assert(!model.textDiffEditorModel);
			});
		}).done(() => {
			done();
		});
	});
开发者ID:StateFarmIns,项目名称:vscode,代码行数:25,代码来源:editorModel.test.ts

示例3: test

	test('getReplaceString returns proper replace string for regExpressions', function () {
		let results = [aRawMatch('file://c:/1', aLineMatch('preview 1', 1, [[1, 3], [4, 7]]))];
		instantiationService.stub(ISearchService, 'search', PPromise.as({ results: results }));

		let testObject: SearchModel = instantiationService.createInstance(SearchModel);
		testObject.search({ contentPattern: { pattern: 're' }, type: 1 });
		testObject.replaceString = 'hello';
		let match = testObject.searchResult.matches()[0].matches()[0];
		assert.equal('hello', match.replaceString);

		testObject.search({ contentPattern: { pattern: 're', isRegExp: true }, type: 1 });
		match = testObject.searchResult.matches()[0].matches()[0];
		assert.equal('hello', match.replaceString);

		testObject.search({ contentPattern: { pattern: 're(?:vi)', isRegExp: true }, type: 1 });
		match = testObject.searchResult.matches()[0].matches()[0];
		assert.equal('hello', match.replaceString);

		testObject.search({ contentPattern: { pattern: 'r(e)(?:vi)', isRegExp: true }, type: 1 });
		match = testObject.searchResult.matches()[0].matches()[0];
		assert.equal('hello', match.replaceString);

		testObject.search({ contentPattern: { pattern: 'r(e)(?:vi)', isRegExp: true }, type: 1 });
		testObject.replaceString = 'hello$1';
		match = testObject.searchResult.matches()[0].matches()[0];
		assert.equal('helloe', match.replaceString);
	});
开发者ID:FabianLauer,项目名称:vscode,代码行数:27,代码来源:searchModel.test.ts

示例4: setup

		setup(() => {
			let contextKeyService = new MockContextKeyService();
			let keybindingService = new MockKeybindingService();
			let terminalFocusContextKey = contextKeyService.createKey('test', false);
			instantiationService = new TestInstantiationService();
			instantiationService.stub(IMessageService, new TestMessageService());
			instantiationService.stub(IWorkspaceContextService, new TestContextService());
			instantiationService.stub(IKeybindingService, keybindingService);
			instantiationService.stub(IContextKeyService, contextKeyService);
			instantiationService.stub(IHistoryService, new TestHistoryService());
			configHelper = {
				config: {
					cwd: null
				}
			};
			instance = instantiationService.createInstance(TestTerminalInstance, terminalFocusContextKey, configHelper, null, null);
		});
开发者ID:SeanKilleen,项目名称:vscode,代码行数:17,代码来源:terminalInstance.test.ts

示例5: suiteSetup

	suiteSetup(() => {
		instantiation = new TestInstantiationService();
		instantiation.stub(IWorkspaceContextService, {
			getConfiguration: () => {
				return {
					env: {
						welcomePage: welcomePageEnvConfig,
						appName: appName
					}
				};
			}
		});
		instantiation.stub(IStorageService, {
			get: () => hideWelcomeSettingsValue,
			store: (value) => hideWelcomeSettingsValue = value
		});
	});
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:17,代码来源:gettingStarted.test.ts

示例6: test

	test('Search Model: Search reports timed telemetry on search when progress is not called', () => {
		let target2 = sinon.spy();
		stub(nullEvent, 'stop', target2);
		let target1 = sinon.stub().returns(nullEvent);
		instantiationService.stub(ITelemetryService, 'publicLog', target1);

		instantiationService.stub(ISearchService, 'search', ppromiseWithProgress([]));

		let testObject = instantiationService.createInstance(SearchModel);
		const result = testObject.search({ contentPattern: { pattern: 'somestring' }, type: 1, folderQueries });

		return result.then(() => {
			return timeout(1).then(() => {
				assert.ok(target1.calledWith('searchResultsFirstRender'));
				assert.ok(target1.calledWith('searchResultsFinished'));
			});
		});
	});
开发者ID:jinlongchen2018,项目名称:vscode,代码行数:18,代码来源:searchModel.test.ts

示例7: setup

	setup(() => {
		configurationService = new TestConfigurationService();
		configurationService.setUserConfiguration('terminal', {
			integrated: {
				shell: {
					linux: TERMINAL_DEFAULT_SHELL_LINUX,
					osx: TERMINAL_DEFAULT_SHELL_OSX,
					windows: TERMINAL_DEFAULT_SHELL_WINDOWS
				},
				setLocaleVariables: false
			}
		});
		instantiationService = new TestInstantiationService();
		instantiationService.stub(IContextKeyService, { createKey: () => null });
		instantiationService.stub(IConfigurationService, configurationService);
		instantiationService.stub(IInstantiationService, instantiationService);
		instantiationService.stub(IWorkspaceContextService, { getWorkspace: () => null });
		service = instantiationService.createInstance(TestTerminalService);
	});
开发者ID:StateFarmIns,项目名称:vscode,代码行数:19,代码来源:terminalService.test.ts

示例8: test

	test('fetch returns keybinding with titles first', async () => {
		const keybindings = prepareKeybindingService(
			aResolvedKeybindingItem({ command: 'a' + uuid.generateUuid(), firstPart: { keyCode: KeyCode.Escape } }),
			aResolvedKeybindingItem({ command: 'b' + uuid.generateUuid(), firstPart: { keyCode: KeyCode.Escape }, chordPart: { keyCode: KeyCode.Escape } }),
			aResolvedKeybindingItem({ command: 'c' + uuid.generateUuid(), firstPart: { keyCode: KeyCode.Escape }, chordPart: { keyCode: KeyCode.Escape } }),
			aResolvedKeybindingItem({ command: 'd' + uuid.generateUuid(), firstPart: { keyCode: KeyCode.Escape }, chordPart: { keyCode: KeyCode.Escape } })
		);

		registerCommandWithTitle(keybindings[1].command!, 'B Title');
		registerCommandWithTitle(keybindings[3].command!, 'A Title');

		const expected = [keybindings[3], keybindings[1], keybindings[0], keybindings[2]];
		instantiationService.stub(IKeybindingService, 'getKeybindings', () => keybindings);
		instantiationService.stub(IKeybindingService, 'getDefaultKeybindings', () => keybindings);

		await testObject.resolve({});
		const actuals = asResolvedKeybindingItems(testObject.fetch(''));
		assertKeybindingItems(actuals, expected);
	});
开发者ID:PKRoma,项目名称:vscode,代码行数:19,代码来源:keybindingsEditorModel.test.ts


注:本文中的vs/platform/instantiation/test/common/instantiationServiceMock.TestInstantiationService.stub方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。