forked from dotnet/vscode-csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request dotnet#2410 from akshita31/find_implementation
Integration test for the implementation provider
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import * as vscode from "vscode"; | ||
import CSharpImplementationProvider from "../../src/features/implementationProvider"; | ||
import * as path from "path"; | ||
import testAssetWorkspace from "./testAssets/testAssetWorkspace"; | ||
import { expect } from "chai"; | ||
import { activateCSharpExtension } from './integrationHelpers'; | ||
|
||
suite(`${CSharpImplementationProvider.name}: ${testAssetWorkspace.description}`, () => { | ||
let fileUri: vscode.Uri; | ||
|
||
suiteSetup(async () => { | ||
await testAssetWorkspace.restore(); | ||
await activateCSharpExtension(); | ||
|
||
let fileName = 'implementation.cs'; | ||
let projectDirectory = testAssetWorkspace.projects[0].projectDirectoryPath; | ||
fileUri = vscode.Uri.file(path.join(projectDirectory, fileName)); | ||
await vscode.commands.executeCommand("vscode.open", fileUri); | ||
}); | ||
|
||
suiteTeardown(async () => { | ||
await testAssetWorkspace.cleanupWorkspace(); | ||
}); | ||
|
||
test("Returns the implementation", async() => { | ||
let implementationList = <vscode.Location[]>(await vscode.commands.executeCommand("vscode.executeImplementationProvider", fileUri, new vscode.Position(4, 22))); | ||
expect(implementationList.length).to.be.equal(2); | ||
}); | ||
}); |
7 changes: 7 additions & 0 deletions
7
test/integrationTests/testAssets/singleCsproj/implementation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using System; | ||
|
||
namespace minimal | ||
{ | ||
public class BaseClass {} | ||
public class SomeClass : BaseClass {} | ||
} |
7 changes: 7 additions & 0 deletions
7
test/integrationTests/testAssets/slnWithCsproj/src/app/implementation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using System; | ||
|
||
namespace minimal | ||
{ | ||
public class BaseClass {} | ||
public class SomeClass : BaseClass {} | ||
} |