當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript eventVerifier.EventVerifierSingle類代碼示例

本文整理匯總了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;未經允許,請勿轉載。