-
Notifications
You must be signed in to change notification settings - Fork 418
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 #1089 from akshita31/class_test
Endpoints for running and debugging all tests in a class
- v1.39.13
- v1.39.13-beta.32
- v1.39.13-beta.31
- v1.39.13-beta.30
- v1.39.13-beta.28
- v1.39.13-beta.9
- v1.39.12
- v1.39.11
- v1.39.10
- v1.39.9
- v1.39.8
- v1.39.7
- v1.39.6
- v1.39.5
- v1.39.4
- v1.39.3
- v1.39.2
- v1.39.1
- v1.39.0
- v1.38.2
- v1.38.1
- v1.38.0
- v1.37.17
- v1.37.16
- v1.37.15
- v1.37.14
- v1.37.13
- v1.37.12
- v1.37.11
- v1.37.10
- v1.37.9
- v1.37.8
- v1.37.7
- v1.37.6
- v1.37.5
- v1.37.4
- v1.37.3
- v1.37.2
- v1.37.1
- v1.37.0
- v1.36.1
- v1.36.0
- v1.35.4
- v1.35.3
- v1.35.2
- v1.35.1
- v1.35.0
- v1.34.15
- v1.34.14
- v1.34.13
- v1.34.12
- v1.34.11
- v1.34.10
- v1.34.9
- v1.34.8
- v1.34.7
- v1.34.6
- v1.34.5
- v1.34.4
- v1.34.3
- v1.34.2
- v1.34.1
- v1.34.0
- v1.33.0
- v1.32.20
- v.1.32.19
- v1.32.19
- v1.32.18
- v1.32.17
- v1.32.16
- v1.32.15
- v1.32.14
- v1.32.13
- v1.32.12
- v1.32.11
- v1.32.10
- v1.32.9
- v1.32.8
- v1.32.7
- v1.32.6
- v1.32.5
- v1.32.4
- v1.32.3
- v1.32.2
- v1.32.1
- v1.32.0
- v1.31.1
- v1.31.0
- v1.30.1
- v1.30.0
- v1.29.1
- v1.29.0
- ca-2.9.2
- ca-2.9.1
- ca-2.9
- 1.34.5
- 1.34.2
Showing
9 changed files
with
139 additions
and
8 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
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
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,15 @@ | ||
using OmniSharp.Models; | ||
|
||
namespace OmniSharp.DotNetTest.Models | ||
{ | ||
public class BaseTestClassRequest : Request | ||
{ | ||
public string[] MethodNames { get; set; } | ||
public string TestFrameworkName { get; set; } | ||
|
||
/// <summary> | ||
/// e.g. .NETCoreApp, Version=2.0 | ||
/// </summary> | ||
public string TargetFrameworkVersion { get; set; } | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/OmniSharp.DotNetTest/Models/DebugTestClassGetStartInfoRequest.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,10 @@ | ||
using OmniSharp.Mef; | ||
using OmniSharp.Models; | ||
|
||
namespace OmniSharp.DotNetTest.Models | ||
{ | ||
[OmniSharpEndpoint(OmniSharpEndpoints.V2.DebugTestsInClassGetStartInfo, typeof(DebugTestClassGetStartInfoRequest), typeof(DebugTestGetStartInfoResponse))] | ||
public class DebugTestClassGetStartInfoRequest : BaseTestClassRequest | ||
{ | ||
} | ||
} |
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,10 @@ | ||
using OmniSharp.Mef; | ||
using OmniSharp.Models; | ||
|
||
namespace OmniSharp.DotNetTest.Models | ||
{ | ||
[OmniSharpEndpoint(OmniSharpEndpoints.V2.RunAllTestsInClass, typeof(RunTestsInClassRequest), typeof(RunTestResponse))] | ||
public class RunTestsInClassRequest : BaseTestClassRequest | ||
{ | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/OmniSharp.DotNetTest/Services/DebugTestClassService.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,35 @@ | ||
using System.Collections.Generic; | ||
using System.Composition; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.Extensions.Logging; | ||
using OmniSharp.DotNetTest.Models; | ||
using OmniSharp.Eventing; | ||
using OmniSharp.Mef; | ||
using OmniSharp.Services; | ||
|
||
namespace OmniSharp.DotNetTest.Services | ||
{ | ||
[OmniSharpHandler(OmniSharpEndpoints.V2.DebugTestsInClassGetStartInfo, LanguageNames.CSharp)] | ||
class DebugTestClassService : BaseTestService, | ||
IRequestHandler<DebugTestClassGetStartInfoRequest, DebugTestGetStartInfoResponse> | ||
{ | ||
private DebugSessionManager _debugSessionManager; | ||
|
||
[ImportingConstructor] | ||
public DebugTestClassService(DebugSessionManager debugSessionManager, OmniSharpWorkspace workspace, DotNetCliService dotNetCli, IEventEmitter eventEmitter, ILoggerFactory loggerFactory) | ||
: base(workspace, dotNetCli, eventEmitter, loggerFactory) | ||
{ | ||
_debugSessionManager = debugSessionManager; | ||
} | ||
|
||
public async Task<DebugTestGetStartInfoResponse> Handle(DebugTestClassGetStartInfoRequest request) | ||
{ | ||
var testManager = CreateTestManager(request.FileName); | ||
_debugSessionManager.StartSession(testManager); | ||
|
||
return await _debugSessionManager.DebugGetStartInfoAsync(request.MethodNames, request.TestFrameworkName, request.TargetFrameworkVersion, CancellationToken.None); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/OmniSharp.DotNetTest/Services/RunTestsInClassService.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,37 @@ | ||
using System.Collections.Generic; | ||
using System.Composition; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.Extensions.Logging; | ||
using OmniSharp.DotNetTest.Models; | ||
using OmniSharp.Eventing; | ||
using OmniSharp.Mef; | ||
using OmniSharp.Services; | ||
|
||
namespace OmniSharp.DotNetTest.Services | ||
{ | ||
[OmniSharpHandler(OmniSharpEndpoints.V2.RunAllTestsInClass, LanguageNames.CSharp)] | ||
internal class RunTestsInClassService : BaseTestService<RunTestsInClassRequest, RunTestResponse> | ||
{ | ||
[ImportingConstructor] | ||
public RunTestsInClassService(OmniSharpWorkspace workspace, DotNetCliService dotNetCli, IEventEmitter eventEmitter, ILoggerFactory loggerFactory) | ||
: base(workspace, dotNetCli, eventEmitter, loggerFactory) | ||
{ | ||
} | ||
|
||
protected override RunTestResponse HandleRequest(RunTestsInClassRequest request, TestManager testManager) | ||
{ | ||
if (testManager.IsConnected) | ||
{ | ||
return testManager.RunTest(request.MethodNames, request.TestFrameworkName, request.TargetFrameworkVersion); | ||
} | ||
|
||
var response = new RunTestResponse | ||
{ | ||
Failure = "Failed to connect to 'dotnet test' process", | ||
Pass = false | ||
}; | ||
|
||
return response; | ||
} | ||
} | ||
} |
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
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