Skip to content

Commit d90593c

Browse files
Refactor a bit and add some more test messages
1 parent 9507516 commit d90593c

8 files changed

+20
-20
lines changed

test/integrationTests/codeActionRename.integration.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import * as vscode from 'vscode';
88
import { should, expect } from 'chai';
99
import { activateCSharpExtension } from './integrationHelpers';
1010
import testAssetWorkspace from './testAssets/testAssetWorkspace';
11-
import { dotnetRestore } from '../../src/features/commands';
12-
import { EventStream } from '../../src/EventStream';
1311

1412
const chai = require('chai');
1513
chai.use(require('chai-arrays'));
@@ -18,7 +16,7 @@ chai.use(require('chai-fs'));
1816
suite(`Code Action Rename ${testAssetWorkspace.description}`, function () {
1917
suiteSetup(async function () {
2018
should();
21-
await dotnetRestore(vscode.workspace.rootPath, new EventStream());
19+
await testAssetWorkspace.restore();
2220
await activateCSharpExtension();
2321
});
2422

test/integrationTests/codeLensProvider.integration.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import * as path from 'path';
99
import { should, expect } from 'chai';
1010
import { activateCSharpExtension } from './integrationHelpers';
1111
import testAssetWorkspace from './testAssets/testAssetWorkspace';
12-
import { dotnetRestore } from '../../src/features/commands';
13-
import { EventStream } from '../../src/EventStream';
1412

1513
const chai = require('chai');
1614
chai.use(require('chai-arrays'));
@@ -21,7 +19,7 @@ suite(`CodeLensProvider: ${testAssetWorkspace.description}`, function () {
2119

2220
suiteSetup(async function () {
2321
should();
24-
await dotnetRestore(vscode.workspace.rootPath, new EventStream());
22+
await testAssetWorkspace.restore();
2523
await activateCSharpExtension();
2624

2725
let fileName = 'Program.cs';

test/integrationTests/documentSymbolProvider.integration.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import * as path from 'path';
99
import { should, expect } from 'chai';
1010
import { activateCSharpExtension } from './integrationHelpers';
1111
import testAssetWorkspace from './testAssets/testAssetWorkspace';
12-
import { dotnetRestore } from '../../src/features/commands';
13-
import { EventStream } from '../../src/EventStream';
1412

1513
const chai = require('chai');
1614
chai.use(require('chai-arrays'));
@@ -21,7 +19,7 @@ suite(`DocumentSymbolProvider: ${testAssetWorkspace.description}`, function () {
2119

2220
suiteSetup(async function () {
2321
should();
24-
await dotnetRestore(vscode.workspace.rootPath, new EventStream());
22+
await testAssetWorkspace.restore();
2523
await activateCSharpExtension();
2624

2725
let fileName = 'documentSymbols.cs';

test/integrationTests/hoverProvider.integration.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import * as path from 'path';
99
import { should, expect } from 'chai';
1010
import { activateCSharpExtension } from './integrationHelpers';
1111
import testAssetWorkspace from './testAssets/testAssetWorkspace';
12-
import { dotnetRestore } from '../../src/features/commands';
13-
import { EventStream } from '../../src/EventStream';
1412

1513
const chai = require('chai');
1614
chai.use(require('chai-arrays'));
@@ -19,7 +17,7 @@ chai.use(require('chai-fs'));
1917
suite(`Hover Provider: ${testAssetWorkspace.description}`, function () {
2018
suiteSetup(async function () {
2119
should();
22-
await dotnetRestore(vscode.workspace.rootPath, new EventStream());
20+
await testAssetWorkspace.restore();
2321
await activateCSharpExtension();
2422
});
2523

test/integrationTests/integrationHelpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export async function activateCSharpExtension(): Promise<void> {
1515

1616
try {
1717
await csharpExtension.exports.initializationFinished();
18+
console.log("ms-vscode.csharp activated");
1819
}
1920
catch (err) {
2021
console.log(JSON.stringify(err));

test/integrationTests/launchConfiguration.integration.test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import poll from './poll';
1010
import { should, expect } from 'chai';
1111
import { activateCSharpExtension } from './integrationHelpers';
1212
import testAssetWorkspace from './testAssets/testAssetWorkspace';
13-
import { dotnetRestore } from '../../src/features/commands';
14-
import { EventStream } from '../../src/EventStream';
1513

1614
const chai = require('chai');
1715
chai.use(require('chai-arrays'));
@@ -20,7 +18,7 @@ chai.use(require('chai-fs'));
2018
suite(`Tasks generation: ${testAssetWorkspace.description}`, function () {
2119
suiteSetup(async function () {
2220
should();
23-
await dotnetRestore(vscode.workspace.rootPath, new EventStream());
21+
await testAssetWorkspace.restore();
2422
await activateCSharpExtension();
2523

2624
await vscode.commands.executeCommand("dotnet.generateAssets");
@@ -33,8 +31,9 @@ suite(`Tasks generation: ${testAssetWorkspace.description}`, function () {
3331
});
3432

3533
test("Starting .NET Core Launch (console) from the workspace root should create an Active Debug Session", async () => {
36-
await vscode.debug.startDebugging(vscode.workspace.workspaceFolders[0], ".NET Core Launch (console)");
37-
34+
let result = await vscode.debug.startDebugging(vscode.workspace.workspaceFolders[0], ".NET Core Launch (console)");
35+
expect(result, "Debugger could not be started.");
36+
3837
let debugSessionTerminated = new Promise(resolve => {
3938
vscode.debug.onDidTerminateDebugSession((e) => resolve());
4039
});

test/integrationTests/signatureHelp.integration.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import * as path from 'path';
99
import { should, expect } from 'chai';
1010
import { activateCSharpExtension } from './integrationHelpers';
1111
import testAssetWorkspace from './testAssets/testAssetWorkspace';
12-
import { dotnetRestore } from '../../src/features/commands';
13-
import { EventStream } from '../../src/EventStream';
1412

1513
const chai = require('chai');
1614
chai.use(require('chai-arrays'));
@@ -21,7 +19,7 @@ suite(`SignatureHelp: ${testAssetWorkspace.description}`, function () {
2119

2220
suiteSetup(async function () {
2321
should();
24-
await dotnetRestore(vscode.workspace.rootPath, new EventStream());
22+
await testAssetWorkspace.restore();
2523
await activateCSharpExtension();
2624

2725
let fileName = 'sigHelp.cs';

test/integrationTests/testAssets/testAssets.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import * as fs from 'async-file';
77
import * as path from 'path';
88
import * as vscode from 'vscode';
99
import spawnGit from './spawnGit';
10+
import { dotnetRestore } from '../../../src/features/commands';
11+
import { EventStream } from '../../../src/EventStream';
1012

1113
export class TestAssetProject {
1214
constructor(project: ITestAssetProject) {
@@ -33,6 +35,10 @@ export class TestAssetProject {
3335
await fs.rimraf(this.objDirectoryPath);
3436
}
3537

38+
async restore(): Promise<void> {
39+
await dotnetRestore(vscode.workspace.rootPath, new EventStream());
40+
}
41+
3642
async addFileWithContents(fileName: string, contents: string): Promise<vscode.Uri> {
3743
let dir = path.dirname(this.projectDirectoryPath);
3844
let loc = path.join(dir, fileName);
@@ -54,6 +60,10 @@ export class TestAssetWorkspace {
5460
this.projects.forEach(async p => await p.deleteBuildArtifacts());
5561
}
5662

63+
async restore(): Promise<void> {
64+
this.projects.forEach(async p => await p.restore());
65+
}
66+
5767
get vsCodeDirectoryPath(): string {
5868
return path.join(vscode.workspace.rootPath, ".vscode");
5969
}

0 commit comments

Comments
 (0)