• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript eventVerifier.EventVerifierSingle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中sqltest/utils/eventVerifier.EventVerifierSingle的典型用法代码示例。如果您正苦于以下问题:TypeScript EventVerifierSingle类的具体用法?TypeScript EventVerifierSingle怎么用?TypeScript EventVerifierSingle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: assertNoEventsFired

function assertNoEventsFired(
	evAdd: EventVerifierSingle<AccountProviderAddedEventParams>,
	evRemove: EventVerifierSingle<sqlops.AccountProviderMetadata>,
	evUpdate: EventVerifierSingle<UpdateAccountListEventParams>
): void {
	evAdd.assertNotFired();
	evRemove.assertNotFired();
	evUpdate.assertNotFired();
}
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:9,代码来源:accountViewModel.test.ts


示例2: test

	test('Initialize - Get accounts fails expects empty array', done => {
		// Setup: Create a mock account management service that rejects the promise
		let mockAccountManagementService = getMockAccountManagementService(true, false);
		let evUpdateAccounts = new EventVerifierSingle<UpdateAccountListEventParams>();
		let vm = getViewModel(mockAccountManagementService.object, evUpdateAccounts);

		// If: I initialize the view model
		vm.initialize()
			.then(result => {
				// Then:
				// ... None of the events should have fired
				evUpdateAccounts.assertNotFired();

				// ... The account management service should have been called
				mockAccountManagementService.verify(x => x.getAccountsForProvider(TypeMoq.It.isAny()), TypeMoq.Times.once());

				// ... The results should be an empty array
				assert.ok(Array.isArray(result));
				assert.equal(result.length, 0);
				assert.equal(result, []);
			}).then(
			() => done(),
			err => done()
			);
	});
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:25,代码来源:accountPickerViewModel.test.ts


示例3: test

	test('Construction - Events are properly defined', () => {
		// Setup:
		// ... Create instantiation service
		let instantiationService = createInstantiationService();

		// ... Create instance of the service and reder account picker
		let service = new AccountPickerService(instantiationService);
		service.renderAccountPicker(TypeMoq.It.isAny());

		// Then:
		// ... All the events for the view models should be properly initialized
		assert.notEqual(service.addAccountCompleteEvent, undefined);
		assert.notEqual(service.addAccountErrorEvent, undefined);
		assert.notEqual(service.addAccountStartEvent, undefined);
		assert.notEqual(service.onAccountSelectionChangeEvent, undefined);


		// ... All the events should properly fire
		let evAddAccountCompleteEvent = new EventVerifierSingle<void>();
		service.addAccountCompleteEvent(evAddAccountCompleteEvent.eventHandler);
		mockAddAccountCompleteEmitter.fire();
		evAddAccountCompleteEvent.assertFired();

		let errorMsg = 'Error';
		let evAddAccountErrorEvent = new EventVerifierSingle<string>();
		service.addAccountErrorEvent(evAddAccountErrorEvent.eventHandler);
		mockAddAccountErrorEmitter.fire(errorMsg);
		evAddAccountErrorEvent.assertFired(errorMsg);

		let evAddAccountStartEvent = new EventVerifierSingle<void>();
		service.addAccountStartEvent(evAddAccountStartEvent.eventHandler);
		mockAddAccountStartEmitter.fire();
		evAddAccountStartEvent.assertFired();

		let account = {
			key: { providerId: 'azure', accountId: 'account1' },
			name: 'Account 1',
			displayInfo: {
				contextualDisplayName: 'Microsoft Account',
				accountType: 'microsoft',
				displayName: 'Account 1'
			},
			properties: [],
			isStale: false
		};
		let evOnAccountSelectionChangeEvent = new EventVerifierSingle<sqlops.Account>();
		service.onAccountSelectionChangeEvent(evOnAccountSelectionChangeEvent.eventHandler);
		mockOnAccountSelectionChangeEvent.fire(account);
		evOnAccountSelectionChangeEvent.assertFired(account);
	});
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:50,代码来源:accountPickerService.test.ts


示例4: test

	test('Construction - Events are properly defined', () => {
		// If: I create an account viewmodel
		let mockAccountManagementService = getMockAccountManagementService(false, false);
		let vm = new AccountViewModel(mockAccountManagementService.object);

		// Then:
		// ... All the events for the view models should be properly initialized
		assert.notEqual(vm.addProviderEvent, undefined);
		assert.notEqual(vm.removeProviderEvent, undefined);
		assert.notEqual(vm.updateAccountListEvent, undefined);

		// ... All the events should properly fire
		let argAddProvider: AccountProviderAddedEventParams = { addedProvider: providers[0], initialAccounts: [] };
		let evAddProvider = new EventVerifierSingle<AccountProviderAddedEventParams>();
		vm.addProviderEvent(evAddProvider.eventHandler);
		mockAddProviderEmitter.fire(argAddProvider);
		evAddProvider.assertFired(argAddProvider);

		let argRemoveProvider = providers[0];
		let evRemoveProvider = new EventVerifierSingle<sqlops.AccountProviderMetadata>();
		vm.removeProviderEvent(evRemoveProvider.eventHandler);
		mockRemoveProviderEmitter.fire(argRemoveProvider);
		evRemoveProvider.assertFired(argRemoveProvider);

		let argUpdateAccounts: UpdateAccountListEventParams = { providerId: providers[0].id, accountList: accounts };
		let evUpdateAccounts = new EventVerifierSingle<UpdateAccountListEventParams>();
		vm.updateAccountListEvent(evUpdateAccounts.eventHandler);
		mockUpdateAccountEmitter.fire(argUpdateAccounts);
		evUpdateAccounts.assertFired(argUpdateAccounts);
	});
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:30,代码来源:accountViewModel.test.ts


示例5:

			.then(results => {
				// Then:
				// ... None of the events should have fired
				evUpdateAccounts.assertNotFired();

				// ... The account management service should have been called
				mockAccountManagementService.verify(x => x.getAccountsForProvider(TypeMoq.It.isAny()), TypeMoq.Times.once());

				// ... The results that were returned should be an array of account
				assert.ok(Array.isArray(results));
				assert.equal(results.length, 2);
				assert.equal(results, accounts);
			}).then(
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:13,代码来源:accountPickerViewModel.test.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript sqs-consumer.create函数代码示例发布时间:2022-05-25
下一篇:
TypeScript sqlstring.format函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap