mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 09:35:36 -05:00
Sql projects: Tests for Create project from database for vscode extension (#21257)
* Test changes * Tests for CreateProjectFromDatabaseQuickpick * Address comments * Update pwd to placeholder
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import * as vscodeMssql from 'vscode-mssql';
|
||||
import { RequestType } from 'vscode-languageclient';
|
||||
|
||||
export interface TestUtils {
|
||||
vscodeMssqlIExtension: TypeMoq.IMock<vscodeMssql.IExtension>;
|
||||
}
|
||||
|
||||
export class MockVscodeMssqlIExtension implements vscodeMssql.IExtension {
|
||||
sqlToolsServicePath: string = '';
|
||||
dacFx: vscodeMssql.IDacFxService;
|
||||
schemaCompare: vscodeMssql.ISchemaCompareService;
|
||||
azureAccountService: vscodeMssql.IAzureAccountService;
|
||||
azureResourceService: vscodeMssql.IAzureResourceService;
|
||||
|
||||
constructor() {
|
||||
this.dacFx = TypeMoq.Mock.ofType<vscodeMssql.IDacFxService>().object;
|
||||
this.schemaCompare = TypeMoq.Mock.ofType<vscodeMssql.ISchemaCompareService>().object;
|
||||
this.azureAccountService = TypeMoq.Mock.ofType<vscodeMssql.IAzureAccountService>().object;
|
||||
this.azureResourceService = TypeMoq.Mock.ofType<vscodeMssql.IAzureResourceService>().object;
|
||||
}
|
||||
|
||||
promptForFirewallRule(_: string, __: vscodeMssql.IConnectionInfo): Promise<boolean> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
sendRequest<P, R, E>(_: RequestType<P, R, E>, __?: P): Promise<R> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
promptForConnection(_?: boolean): Promise<vscodeMssql.IConnectionInfo | undefined> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
connect(_: vscodeMssql.IConnectionInfo, __?: boolean): Promise<string> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
listDatabases(_: string): Promise<string[]> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
getDatabaseNameFromTreeNode(_: vscodeMssql.ITreeNodeInfo): string {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
getConnectionString(_: string | vscodeMssql.ConnectionDetails, ___?: boolean, _____?: boolean): Promise<string> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
createConnectionDetails(_: vscodeMssql.IConnectionInfo): vscodeMssql.ConnectionDetails {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
getServerInfo(_: vscodeMssql.IConnectionInfo): vscodeMssql.ServerInfo {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
export function createTestUtils(): TestUtils {
|
||||
return {
|
||||
vscodeMssqlIExtension: TypeMoq.Mock.ofType(MockVscodeMssqlIExtension)
|
||||
};
|
||||
}
|
||||
|
||||
// Mock test data
|
||||
export const mockConnectionInfo: vscodeMssql.IConnectionInfo = {
|
||||
server: 'Server',
|
||||
database: 'Database',
|
||||
user: 'User',
|
||||
password: 'Placeholder',
|
||||
email: 'test-email',
|
||||
accountId: 'test-account-id',
|
||||
tenantId: 'test-tenant-id',
|
||||
port: 1234,
|
||||
authenticationType: vscodeMssql.AuthenticationType.SqlLogin,
|
||||
azureAccountToken: '',
|
||||
expiresOn: 0,
|
||||
encrypt: false,
|
||||
trustServerCertificate: false,
|
||||
persistSecurityInfo: false,
|
||||
connectTimeout: 15,
|
||||
connectRetryCount: 0,
|
||||
connectRetryInterval: 0,
|
||||
applicationName: 'vscode-mssql',
|
||||
workstationId: 'test',
|
||||
applicationIntent: '',
|
||||
currentLanguage: '',
|
||||
pooling: true,
|
||||
maxPoolSize: 15,
|
||||
minPoolSize: 0,
|
||||
loadBalanceTimeout: 0,
|
||||
replication: false,
|
||||
attachDbFilename: '',
|
||||
failoverPartner: '',
|
||||
multiSubnetFailover: false,
|
||||
multipleActiveResultSets: false,
|
||||
packetSize: 8192,
|
||||
typeSystemVersion: 'Latest',
|
||||
connectionString: ''
|
||||
};
|
||||
Reference in New Issue
Block a user