本文整理匯總了TypeScript中vs/workbench/parts/experiments/test/node/experimentService.test.TestExperimentService類的典型用法代碼示例。如果您正苦於以下問題:TypeScript test.TestExperimentService類的具體用法?TypeScript test.TestExperimentService怎麽用?TypeScript test.TestExperimentService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了test.TestExperimentService類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: suite
suite('Experimental Prompts', () => {
let instantiationService: TestInstantiationService;
let experimentService: TestExperimentService;
let experimentalPrompt: ExperimentalPrompts;
let onExperimentEnabledEvent: Emitter<IExperiment>;
let storageData = {};
const promptText = 'Hello there! Can you see this?';
const experiment: IExperiment =
{
id: 'experiment1',
enabled: true,
state: ExperimentState.Run,
action: {
type: ExperimentActionType.Prompt,
properties: {
promptText,
commands: [
{
text: 'Yes',
dontShowAgain: true
},
{
text: 'No'
}
]
}
}
};
suiteSetup(() => {
instantiationService = new TestInstantiationService();
instantiationService.stub(ILifecycleService, new TestLifecycleService());
instantiationService.stub(ITelemetryService, NullTelemetryService);
onExperimentEnabledEvent = new Emitter<IExperiment>();
});
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);
});
teardown(() => {
if (experimentService) {
experimentService.dispose();
}
if (experimentalPrompt) {
experimentalPrompt.dispose();
}
});
test('Show experimental prompt if experiment should be run. Choosing an option should mark experiment as complete', () => {
storageData = {
enabled: true,
state: ExperimentState.Run
};
instantiationService.stub(INotificationService, {
prompt: (a: Severity, b: string, c: IPromptChoice[], d) => {
assert.equal(b, promptText);
assert.equal(c.length, 2);
c[0].run();
}
});
experimentalPrompt = instantiationService.createInstance(ExperimentalPrompts);
onExperimentEnabledEvent.fire(experiment);
return TPromise.as(null).then(result => {
assert.equal(storageData['state'], ExperimentState.Complete);
});
});
});
示例2:
teardown(() => {
if (experimentService) {
experimentService.dispose();
}
if (experimentalPrompt) {
experimentalPrompt.dispose();
}
});