本文整理汇总了TypeScript中sqltest/utils/eventVerifier.EventVerifierSingle.assertFired方法的典型用法代码示例。如果您正苦于以下问题:TypeScript EventVerifierSingle.assertFired方法的具体用法?TypeScript EventVerifierSingle.assertFired怎么用?TypeScript EventVerifierSingle.assertFired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sqltest/utils/eventVerifier.EventVerifierSingle
的用法示例。
在下文中一共展示了EventVerifierSingle.assertFired方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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);
});
示例2: 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);
});
示例3: test
test('Construction - Events are properly defined', () => {
// If: I create an account picker viewmodel
let mockAccountManagementService = getMockAccountManagementService(false, false);
let vm = new AccountPickerViewModel('azure', mockAccountManagementService.object);
// Then:
// ... The event for the view models should be properly initialized
assert.notEqual(vm.updateAccountListEvent, undefined);
// ... The event should properly fire
let argUpdateAccounts: UpdateAccountListEventParams = { providerId: providers[0].id, accountList: accounts };
let evUpdateAccounts = new EventVerifierSingle<UpdateAccountListEventParams>();
vm.updateAccountListEvent(evUpdateAccounts.eventHandler);
mockUpdateAccountEmitter.fire(argUpdateAccounts);
evUpdateAccounts.assertFired(argUpdateAccounts);
});