mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 09:35:36 -05:00
Adding a few tests for Add SQL binding (#17079)
* initial changes * add a couple more tests
This commit is contained in:
@@ -8,10 +8,12 @@ import * as azdata from 'azdata';
|
||||
import * as path from 'path';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import * as mssql from '../../../mssql/src/mssql';
|
||||
import * as vscodeMssql from 'vscode-mssql';
|
||||
|
||||
export interface TestContext {
|
||||
context: vscode.ExtensionContext;
|
||||
dacFxService: TypeMoq.IMock<mssql.IDacFxService>;
|
||||
azureFunctionService: TypeMoq.IMock<vscodeMssql.IAzureFunctionsService>;
|
||||
outputChannel: vscode.OutputChannel;
|
||||
}
|
||||
|
||||
@@ -119,6 +121,22 @@ export class MockDacFxService implements mssql.IDacFxService {
|
||||
public validateStreamingJob(_: string, __: string): Thenable<mssql.ValidateStreamingJobResult> { return Promise.resolve(mockDacFxResult); }
|
||||
}
|
||||
|
||||
export const mockResultStatus = {
|
||||
success: true,
|
||||
errorMessage: ''
|
||||
};
|
||||
|
||||
export const mockGetAzureFunctionsResult = {
|
||||
success: true,
|
||||
errorMessage: '',
|
||||
azureFunctions: []
|
||||
};
|
||||
|
||||
export class MockAzureFunctionService implements vscodeMssql.IAzureFunctionsService {
|
||||
addSqlBinding(_: vscodeMssql.BindingType, __: string, ___: string, ____: string, _____: string): Thenable<vscodeMssql.ResultStatus> { return Promise.resolve(mockResultStatus); }
|
||||
getAzureFunctions(_: string): Thenable<vscodeMssql.GetAzureFunctionsResult> { return Promise.resolve(mockGetAzureFunctionsResult); }
|
||||
}
|
||||
|
||||
export function createContext(): TestContext {
|
||||
let extensionPath = path.join(__dirname, '..', '..');
|
||||
|
||||
@@ -149,6 +167,7 @@ export function createContext(): TestContext {
|
||||
extension: undefined as any
|
||||
},
|
||||
dacFxService: TypeMoq.Mock.ofType(MockDacFxService),
|
||||
azureFunctionService: TypeMoq.Mock.ofType(MockAzureFunctionService),
|
||||
outputChannel: {
|
||||
name: '',
|
||||
append: () => { },
|
||||
|
||||
Reference in New Issue
Block a user