@@ -13,6 +13,7 @@ import * as fs from 'fs-extra-promise';
1313import * as path from 'path' ;
1414import * as protocol from '../protocol' ;
1515import * as vscode from 'vscode' ;
16+ import * as dotnetTest from './dotnetTest'
1617
1718let channel = vscode . window . createOutputChannel ( '.NET' ) ;
1819
@@ -27,37 +28,8 @@ export default function registerCommands(server: OmnisharpServer, extensionPath:
2728 let d5 = vscode . commands . registerCommand ( 'csharp.downloadDebugger' , ( ) => { } ) ;
2829
2930 return vscode . Disposable . from ( d1 , d2 , d3 , d4 , d5 ,
30- vscode . commands . registerCommand ( 'dotnet.test.run' , ( testMethod , fileName ) => runDotnetTest ( testMethod , fileName , server ) ) ,
31- vscode . commands . registerCommand ( 'dotnet.test.debug' , ( testMethod , fileName ) => debugDotnetTest ( testMethod , fileName , server ) ) ) ;
32- }
33-
34- // Run test through dotnet-test command. This function can be moved to a separate structure
35- function runDotnetTest ( testMethod : string , fileName : string , server : OmnisharpServer ) {
36- serverUtils . runDotNetTest ( server , { FileName : fileName , MethodName : testMethod } ) . then ( response => {
37- if ( response . Pass ) {
38- vscode . window . showInformationMessage ( 'Test passed' ) ;
39- }
40- else {
41- vscode . window . showErrorMessage ( 'Test failed' ) ;
42- }
43- } ) ;
44- }
45-
46- // Run test through dotnet-test command with debugger attached
47- function debugDotnetTest ( testMethod : string , fileName : string , server : OmnisharpServer ) {
48- serverUtils . getTestStartInfo ( server , { FileName : fileName , MethodName : testMethod } ) . then ( response => {
49- vscode . commands . executeCommand (
50- 'vscode.startDebug' , {
51- "name" : ".NET test launch" ,
52- "type" : "coreclr" ,
53- "request" : "launch" ,
54- "program" : response . Executable ,
55- "args" : response . Argument . split ( ' ' ) ,
56- "cwd" : "${workspaceRoot}" ,
57- "stopAtEntry" : false
58- }
59- ) ;
60- } ) ;
31+ dotnetTest . registerDotNetTestRunCommand ( server ) ,
32+ dotnetTest . registerDotNetTestDebugCommand ( server ) ) ;
6133}
6234
6335function pickProjectAndStart ( server : OmnisharpServer ) {
0 commit comments