提交 9db22db1 编写于 作者: B Benjamin Pasero

kein bock auf mock

上级 4645522d
...@@ -23,7 +23,6 @@ import { IModelService } from 'vs/editor/common/services/modelService'; ...@@ -23,7 +23,6 @@ import { IModelService } from 'vs/editor/common/services/modelService';
import { EditOperation } from 'vs/editor/common/core/editOperation'; import { EditOperation } from 'vs/editor/common/core/editOperation';
import { TestFileService, TestEditorService, TestEditorGroupsService, TestEnvironmentService, TestContextService } from 'vs/workbench/test/workbenchTestServices'; import { TestFileService, TestEditorService, TestEditorGroupsService, TestEnvironmentService, TestContextService } from 'vs/workbench/test/workbenchTestServices';
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import { IFileStat } from 'vs/platform/files/common/files';
import { ResourceTextEdit } from 'vs/editor/common/modes'; import { ResourceTextEdit } from 'vs/editor/common/modes';
import { BulkEditService } from 'vs/workbench/services/bulkEdit/electron-browser/bulkEditService'; import { BulkEditService } from 'vs/workbench/services/bulkEdit/electron-browser/bulkEditService';
import { NullLogService } from 'vs/platform/log/common/log'; import { NullLogService } from 'vs/platform/log/common/log';
...@@ -48,16 +47,14 @@ suite('MainThreadEditors', () => { ...@@ -48,16 +47,14 @@ suite('MainThreadEditors', () => {
createdResources.clear(); createdResources.clear();
deletedResources.clear(); deletedResources.clear();
const fileService = new class extends TestFileService { const fileService = new TestFileService();
createFile(uri: URI): TPromise<IFileStat> {
createdResources.add(uri);
return TPromise.wrap(createMockFileStat(uri));
}
};
const textFileService = new class extends mock<ITextFileService>() { const textFileService = new class extends mock<ITextFileService>() {
isDirty() { return false; } isDirty() { return false; }
create(uri: URI, contents?: string, options?: any) {
createdResources.add(uri);
return TPromise.as(void 0);
}
delete(resource: URI) { delete(resource: URI) {
deletedResources.add(resource); deletedResources.add(resource);
return TPromise.as(void 0); return TPromise.as(void 0);
...@@ -75,7 +72,7 @@ suite('MainThreadEditors', () => { ...@@ -75,7 +72,7 @@ suite('MainThreadEditors', () => {
const workbenchEditorService = new TestEditorService(); const workbenchEditorService = new TestEditorService();
const editorGroupService = new TestEditorGroupsService(); const editorGroupService = new TestEditorGroupsService();
const bulkEditService = new BulkEditService(new NullLogService(), modelService, new TestEditorService(), null, fileService, textFileService, TestEnvironmentService, new TestContextService()); const bulkEditService = new BulkEditService(new NullLogService(), modelService, new TestEditorService(), null, new TestFileService(), textFileService, TestEnvironmentService, new TestContextService());
const rpcProtocol = new TestRPCProtocol(); const rpcProtocol = new TestRPCProtocol();
rpcProtocol.set(ExtHostContext.ExtHostDocuments, new class extends mock<ExtHostDocumentsShape>() { rpcProtocol.set(ExtHostContext.ExtHostDocuments, new class extends mock<ExtHostDocumentsShape>() {
...@@ -132,7 +129,7 @@ suite('MainThreadEditors', () => { ...@@ -132,7 +129,7 @@ suite('MainThreadEditors', () => {
}); });
}); });
test(`applyWorkspaceEdit with only resource edit`, () => { test(`pasero applyWorkspaceEdit with only resource edit`, () => {
return editors.$tryApplyWorkspaceEdit({ return editors.$tryApplyWorkspaceEdit({
edits: [ edits: [
{ oldUri: resource, newUri: resource, options: undefined }, { oldUri: resource, newUri: resource, options: undefined },
...@@ -147,14 +144,3 @@ suite('MainThreadEditors', () => { ...@@ -147,14 +144,3 @@ suite('MainThreadEditors', () => {
}); });
}); });
}); });
function createMockFileStat(target: URI): IFileStat {
return {
etag: '',
isDirectory: false,
name: target.path,
mtime: 0,
resource: target
};
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册