|
| 1 | +using System.Threading.Tasks; |
| 2 | +using ICSharpCode.CodeConverter.Tests.TestRunners; |
| 3 | +using Xunit; |
| 4 | + |
| 5 | +namespace ICSharpCode.CodeConverter.Tests.CSharp.ExpressionTests; |
| 6 | + |
| 7 | +public class LambdaTests : ConverterTestBase |
| 8 | +{ |
| 9 | + [Fact] |
| 10 | + public async Task Issue1012_MultiLineLambdaWithSingleStatement() |
| 11 | + { |
| 12 | + await TestConversionVisualBasicToCSharpAsync(@"Imports System.Collections.Generic |
| 13 | +Imports System.Linq |
| 14 | +Imports System.Threading.Tasks |
| 15 | +
|
| 16 | +Public Class ConversionTest3 |
| 17 | + Private Class MyEntity |
| 18 | + Property EntityId As Integer |
| 19 | + Property Name As String |
| 20 | + End Class |
| 21 | + Private Sub BugRepro() |
| 22 | +
|
| 23 | + Dim entities As New List(Of MyEntity) |
| 24 | +
|
| 25 | + Parallel.For(1, 3, Sub(i) |
| 26 | + Dim result As String = (From e In entities |
| 27 | + Where e.EntityId = 123 |
| 28 | + Select e.Name).Single |
| 29 | + End Sub) |
| 30 | + End Sub |
| 31 | +End Class", @"using System.Collections.Generic; |
| 32 | +using System.Linq; |
| 33 | +using System.Threading.Tasks; |
| 34 | +
|
| 35 | +public partial class ConversionTest3 |
| 36 | +{ |
| 37 | + private partial class MyEntity |
| 38 | + { |
| 39 | + public int EntityId { get; set; } |
| 40 | + public string Name { get; set; } |
| 41 | + } |
| 42 | + private void BugRepro() |
| 43 | + { |
| 44 | +
|
| 45 | + var entities = new List<MyEntity>(); |
| 46 | +
|
| 47 | + Parallel.For(1, 3, i => |
| 48 | + { |
| 49 | + string result = (from e in entities |
| 50 | + where e.EntityId == 123 |
| 51 | + select e.Name).Single(); |
| 52 | + }); |
| 53 | + } |
| 54 | +}"); |
| 55 | + } |
| 56 | +} |
0 commit comments