Archived
Add main controller tests for a few extensions (#11307)
* add a few tests * fix errors * undo change * move registering commands to extension.ts for dacpac and schema compare * undo createController() addition * fix whitespace
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Disposable, ExtensionContext } from 'vscode';
|
||||
import { SchemaCompareMainWindow } from '../schemaCompareMainWindow';
|
||||
import { ApiWrapper } from '../common/apiWrapper';
|
||||
|
||||
/**
|
||||
* The main controller class that initializes the extension
|
||||
*/
|
||||
export default class MainController implements Disposable {
|
||||
protected schemaCompareMainWindow: SchemaCompareMainWindow;
|
||||
|
||||
public constructor(private context: ExtensionContext, private apiWrapper: ApiWrapper) {
|
||||
this.schemaCompareMainWindow = new SchemaCompareMainWindow(this.apiWrapper, null, this.extensionContext);
|
||||
}
|
||||
|
||||
public get extensionContext(): ExtensionContext {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
public deactivate(): void {
|
||||
}
|
||||
|
||||
public activate(): Promise<boolean> {
|
||||
this.initializeSchemaCompareDialog();
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
private initializeSchemaCompareDialog(): void {
|
||||
this.apiWrapper.registerCommand('schemaCompare.start', async (context: any) => { await this.schemaCompareMainWindow.start(context); });
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.deactivate();
|
||||
}
|
||||
}
|
||||
@@ -4,22 +4,12 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import MainController from './controllers/mainController';
|
||||
import { ApiWrapper } from './common/apiWrapper';
|
||||
import { SchemaCompareMainWindow } from './schemaCompareMainWindow';
|
||||
|
||||
let controllers: MainController[] = [];
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext): Promise<void> {
|
||||
// Start the main controller
|
||||
let mainController = new MainController(context, new ApiWrapper());
|
||||
controllers.push(mainController);
|
||||
context.subscriptions.push(mainController);
|
||||
|
||||
await mainController.activate();
|
||||
export async function activate(extensionContext: vscode.ExtensionContext): Promise<void> {
|
||||
vscode.commands.registerCommand('schemaCompare.start', async (context: any) => { await new SchemaCompareMainWindow(new ApiWrapper(), undefined, extensionContext).start(context); });
|
||||
}
|
||||
|
||||
export function deactivate(): void {
|
||||
for (let controller of controllers) {
|
||||
controller.deactivate();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user