|
1 | 1 | using AwesomeAssertions; |
| 2 | +using Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages; |
2 | 3 | using SharpDbg.Cli.Tests.Helpers; |
3 | 4 |
|
4 | 5 | namespace SharpDbg.Cli.Tests; |
@@ -27,5 +28,28 @@ await debugProtocolHost |
27 | 28 | var stopInfo = stoppedEvent.ReadStopInfo(); |
28 | 29 | stopInfo.filePath.Should().EndWith("MyLambdaClass.cs"); |
29 | 30 | stopInfo.line.Should().Be(11); |
| 31 | + |
| 32 | + debugProtocolHost |
| 33 | + .WithStackTraceRequest(stoppedEvent.ThreadId!.Value, out var stackTraceResponse) |
| 34 | + .WithScopesRequest(stackTraceResponse.StackFrames!.First().Id, out var scopesResponse); |
| 35 | + |
| 36 | + scopesResponse.Scopes.Should().HaveCount(1); |
| 37 | + var scope = scopesResponse.Scopes.Single(); |
| 38 | + |
| 39 | + List<Variable> expectedVariables = |
| 40 | + [ |
| 41 | + new() {Name = "this", Value = "{DebuggableConsoleApp.Lambdas.MyLambdaClass}", Type = "DebuggableConsoleApp.Lambdas.MyLambdaClass", EvaluateName = "this", VariablesReference = 3 }, |
| 42 | + new() {Name = "capturedIntField", EvaluateName = "capturedIntField", Value = "4", Type = "int" }, |
| 43 | + new() {Name = "capturedString", EvaluateName = "capturedString", Value = "asdf", Type = "string" }, |
| 44 | + new() {Name = "result", EvaluateName = "result", Value = "0", Type = "int" }, |
| 45 | + new() {Name = "test", EvaluateName = "test", Value = "asdf", Type = "string" }, |
| 46 | + new() {Name = "x", EvaluateName = "x", Value = "5", Type = "int" }, |
| 47 | + |
| 48 | + ]; |
| 49 | + |
| 50 | + debugProtocolHost.WithVariablesRequest(scope.VariablesReference, out var variables); |
| 51 | + |
| 52 | + variables.Should().HaveCount(6); |
| 53 | + variables.Should().BeEquivalentTo(expectedVariables); |
30 | 54 | } |
31 | 55 | } |
0 commit comments