1+ /*---------------------------------------------------------------------------------------------
2+ * Copyright (c) Microsoft Corporation. All rights reserved.
3+ * Licensed under the MIT License. See License.txt in the project root for license information.
4+ *--------------------------------------------------------------------------------------------*/
5+
6+ import * as vscode from "vscode" ;
7+ import CSharpImplementationProvider from "../../src/features/implementationProvider" ;
8+ import CSharpExtensionExports from "../../src/CSharpExtensionExports" ;
9+ import * as path from "path" ;
10+ import testAssetWorkspace from "./testAssets/testAssetWorkspace" ;
11+ import { expect } from "chai" ;
12+
13+ suite ( `${ CSharpImplementationProvider . name } : ${ testAssetWorkspace . description } ` , ( ) => {
14+ let fileUri : vscode . Uri ;
15+
16+ suiteSetup ( async ( ) => {
17+ let csharpExtension = vscode . extensions . getExtension < CSharpExtensionExports > ( "ms-vscode.csharp" ) ;
18+ if ( ! csharpExtension . isActive ) {
19+ await csharpExtension . activate ( ) ;
20+ }
21+
22+ await csharpExtension . exports . initializationFinished ( ) ;
23+ let fileName = 'implementation.cs' ;
24+ let dir = path . dirname ( testAssetWorkspace . projects [ 0 ] . projectDirectoryPath ) ;
25+ fileUri = vscode . Uri . file ( path . join ( dir , fileName ) ) ;
26+ await vscode . commands . executeCommand ( "vscode.open" , fileUri ) ;
27+ } ) ;
28+
29+ suiteTeardown ( async ( ) => {
30+ await testAssetWorkspace . cleanupWorkspace ( ) ;
31+ } ) ;
32+
33+ test ( "Returns the implementation" , async ( ) => {
34+ let implementationList = < vscode . Location [ ] > ( await vscode . commands . executeCommand ( "vscode.executeImplementationProvider" , fileUri , new vscode . Position ( 4 , 22 ) ) ) ;
35+ expect ( implementationList . length ) . to . be . equal ( 2 ) ;
36+ } ) ;
37+ } ) ;
0 commit comments