forked from icsharpcode/CodeConverter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPropertyMemberTests.cs
More file actions
922 lines (836 loc) · 21.7 KB
/
PropertyMemberTests.cs
File metadata and controls
922 lines (836 loc) · 21.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
using System.Threading.Tasks;
using ICSharpCode.CodeConverter.Tests.TestRunners;
using Xunit;
namespace ICSharpCode.CodeConverter.Tests.CSharp.MemberTests;
public class PropertyMemberTests : ConverterTestBase
{
[Fact]
public async Task TestPropertyAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Class TestClass
Public Property Test As Integer
Public Property Test2 As Integer
Get
Return 0
End Get
End Property
Private m_test3 As Integer
Public Property Test3 As Integer
Get
If 7 = Integer.Parse(""7"") Then Exit Property
Return Me.m_test3
End Get
Set(ByVal value As Integer)
If 7 = Integer.Parse(""7"") Then Exit Property
Me.m_test3 = value
End Set
End Property
End Class", @"
internal partial class TestClass
{
public int Test { get; set; }
public int Test2
{
get
{
return 0;
}
}
private int m_test3;
public int Test3
{
get
{
if (7 == int.Parse(""7""))
return default;
return m_test3;
}
set
{
if (7 == int.Parse(""7""))
return;
m_test3 = value;
}
}
}
1 source compilation errors:
BC30124: Property without a 'ReadOnly' or 'WriteOnly' specifier must provide both a 'Get' and a 'Set'.");
}
[Fact]
public async Task TestWriteOnlyPropertyExitAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Class TestClass
Private m_value As Integer
Public WriteOnly Property Value As Integer
Set(ByVal value As Integer)
If value = 0 Then Exit Property
m_value = value
End Set
End Property
End Class", @"
internal partial class TestClass
{
private int m_value;
public int Value
{
set
{
if (value == 0)
return;
m_value = value;
}
}
}");
}
[Fact]
public async Task TestExitPropertyInTaskReturningGetterAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Imports System.Threading.Tasks
Class TestClass
Public ReadOnly Property Value As Task(Of Integer)
Get
Exit Property
End Get
End Property
End Class", @"using System.Threading.Tasks;
internal partial class TestClass
{
public Task<int> Value
{
get
{
return default;
}
}
}");
}
[Fact]
public async Task TestParameterizedPropertyAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Class TestClass
Public Property FirstName As String
Public Property LastName As String
Public Property FullName(ByVal lastNameFirst As Boolean, ByVal isFirst As Boolean) As String
Get
If lastNameFirst Then
Return LastName & "" "" & FirstName
Else
Return FirstName & "" "" & LastName
End If
End Get
' This comment belongs to the set method
Friend Set
If isFirst Then FirstName = Value
End Set
End Property
Public Overrides Function ToString() As String
FullName(False, True) = ""hello""
Return FullName(False, True)
End Function
End Class", @"
internal partial class TestClass
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string get_FullName(bool lastNameFirst, bool isFirst)
{
if (lastNameFirst)
{
return LastName + "" "" + FirstName;
}
else
{
return FirstName + "" "" + LastName;
}
}
// This comment belongs to the set method
internal void set_FullName(bool lastNameFirst, bool isFirst, string value)
{
if (isFirst)
FirstName = value;
}
public override string ToString()
{
set_FullName(false, true, ""hello"");
return get_FullName(false, true);
}
}");
}
[Fact]
public async Task TestParameterizedPropertyRequiringConversionAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Public Class Class1
Public Property SomeProp(ByVal index As Integer) As Single
Get
Return 1.5
End Get
Set(ByVal Value As Single)
End Set
End Property
Public Sub Foo()
Dim someDecimal As Decimal = 123.0
SomeProp(123) = someDecimal
End Sub
End Class", @"
public partial class Class1
{
public float get_SomeProp(int index)
{
return 1.5f;
}
public void set_SomeProp(int index, float value)
{
}
public void Foo()
{
decimal someDecimal = 123.0m;
set_SomeProp(123, (float)someDecimal);
}
}");
}
[Fact] //https://github.com/icsharpcode/CodeConverter/issues/642
public async Task TestOptionalParameterizedPropertyAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Class TestClass
Public Property FirstName As String
Public Property LastName As String
Public Property FullName(Optional ByVal isFirst As Boolean = False) As String
Get
Return FirstName & "" "" & LastName
End Get
'This comment belongs to the set method
Friend Set
If isFirst Then FirstName = Value
End Set
End Property
Public Overrides Function ToString() As String
FullName(True) = ""hello2""
FullName() = ""hello3""
FullName = ""hello4""
Return FullName
End Function
End Class", @"
internal partial class TestClass
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string get_FullName(bool isFirst = false)
{
return FirstName + "" "" + LastName;
}
// This comment belongs to the set method
internal void set_FullName(bool isFirst = false, string value = default)
{
if (isFirst)
FirstName = value;
}
public override string ToString()
{
set_FullName(true, ""hello2"");
set_FullName(value: ""hello3"");
set_FullName(value: ""hello4"");
return get_FullName();
}
}");
}
[Fact]
public async Task TestParameterizedPropertyAndGenericInvocationAndEnumEdgeCasesAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Public Class ParameterizedPropertiesAndEnumTest
Public Enum MyEnum
First
End Enum
Public Property MyProp(ByVal blah As Integer) As String
Get
Return blah
End Get
Set
End Set
End Property
Public Sub ReturnWhatever(ByVal m As MyEnum)
Dim enumerableThing = Enumerable.Empty(Of String)
Select Case m
Case -1
Exit Sub
Case MyEnum.First
Exit Sub
Case 3
Me.MyProp(4) = enumerableThing.ToArray()(m)
Exit Sub
End Select
End Sub
End Class", @"using System.Linq;
public partial class ParameterizedPropertiesAndEnumTest
{
public enum MyEnum
{
First
}
public string get_MyProp(int blah)
{
return blah.ToString();
}
public void set_MyProp(int blah, string value)
{
}
public void ReturnWhatever(MyEnum m)
{
var enumerableThing = Enumerable.Empty<string>();
switch (m)
{
case (MyEnum)(-1):
{
return;
}
case MyEnum.First:
{
return;
}
case (MyEnum)3:
{
set_MyProp(4, enumerableThing.ToArray()[(int)m]);
return;
}
}
}
}");
}
[Fact]
public async Task TestParameterizedPropertyWithTriviaAsync()
{
//issue 1095
await TestConversionVisualBasicToCSharpAsync(
@"Class IndexedPropertyWithTrivia
'a
Property P(i As Integer) As Integer
'b
Get
'1
Dim x = 1 '2
'3
End Get
'c
Set(value As Integer)
'4
Dim x = 1 '5
'6
x = value + i '7
'8
End Set
'd
End Property
End Class", @"
internal partial class IndexedPropertyWithTrivia
{
// a
// b
public int get_P(int i)
{
// 1
int x = 1; // 2
return default;
// 3
}
// c
public void set_P(int i, int value)
{
// 4
int x = 1; // 5
// 6
x = value + i; // 7
// 8
// d
}
}");
}
[Fact]
public async Task PropertyWithMissingTypeDeclarationAsync()//TODO Check object is the inferred type
{
await TestConversionVisualBasicToCSharpAsync(
@"Class MissingPropertyType
ReadOnly Property Max
Get
Dim mx As Double = 0
Return mx
End Get
End Property
End Class", @"
internal partial class MissingPropertyType
{
public object Max
{
get
{
double mx = 0d;
return mx;
}
}
}");
}
[Fact]
public async Task TestReadWriteOnlyInterfacePropertyAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Public Interface Foo
ReadOnly Property P1() As String
WriteOnly Property P2() As String
End Interface", @"
public partial interface Foo
{
string P1 { get; }
string P2 { set; }
}");
}
[Fact]
public async Task SynthesizedBackingFieldAccessAsync()
{
await TestConversionVisualBasicToCSharpAsync(@"Class TestClass
Private Shared Property First As Integer
Private Second As Integer = _First
End Class", @"
internal partial class TestClass
{
private static int First { get; set; }
private int Second = First;
}");
}
[Fact]
public async Task PropertyInitializersAsync()
{
await TestConversionVisualBasicToCSharpAsync(@"Class TestClass
Private ReadOnly Property First As New List(Of String)
Private Property Second As Integer = 0
End Class", @"using System.Collections.Generic;
internal partial class TestClass
{
private List<string> First { get; set; } = new List<string>();
private int Second { get; set; } = 0;
}");
}
[Fact]
public async Task TestIndexerAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Class TestClass
Private _Items As Integer()
Default Public Property Item(ByVal index As Integer) As Integer
Get
Return _Items(index)
End Get
Set(ByVal value As Integer)
_Items(index) = value
End Set
End Property
Default Public ReadOnly Property Item(ByVal index As String) As Integer
Get
Return 0
End Get
End Property
Private m_test3 As Integer
Default Public Property Item(ByVal index As Double) As Integer
Get
Return Me.m_test3
End Get
Set(ByVal value As Integer)
Me.m_test3 = value
End Set
End Property
End Class", @"
internal partial class TestClass
{
private int[] _Items;
public int this[int index]
{
get
{
return _Items[index];
}
set
{
_Items[index] = value;
}
}
public int this[string index]
{
get
{
return 0;
}
}
private int m_test3;
public int this[double index]
{
get
{
return m_test3;
}
set
{
m_test3 = value;
}
}
}");
}
[Fact]
public async Task TestWriteOnlyPropertiesAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Interface TestInterface
WriteOnly Property Items As Integer()
End Interface", @"
internal partial interface TestInterface
{
int[] Items { set; }
}");
}
[Fact]
public async Task TestImplicitPrivateSetterAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Public Class SomeClass
Public ReadOnly Property SomeValue As Integer
Public Sub SetValue(value1 As Integer, value2 As Integer)
_SomeValue = value1 + value2
End Sub
End Class", @"
public partial class SomeClass
{
public int SomeValue { get; private set; }
public void SetValue(int value1, int value2)
{
SomeValue = value1 + value2;
}
}");
}
[Fact]
public async Task TestParametrizedPropertyCalledWithNamedArgumentsAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"
Public Interface IFoo
Property Prop(Optional x As Integer = 1, Optional y as Integer = 2) As Integer
End Interface
Public Class SomeClass
Implements IFoo
Friend Property Prop2(Optional x As Integer = 1, Optional y as Integer = 2) As Integer Implements IFoo.Prop
Get
End Get
Set
End Set
End Property
Sub TestGet()
Dim foo As IFoo = Me
Dim a = Prop2() + Prop2(y := 20) + Prop2(x := 10) + Prop2(y := -2, x := -1) + Prop2(x := -1, y := -2)
Dim b = foo.Prop() + foo.Prop(y := 20) + foo.Prop(x := 10) + foo.Prop(y := -2, x := -1) + foo.Prop(x := -1, y := -2)
End Sub
Sub TestSet()
Prop2() = 1
Prop2(-1, -2) = 1
Prop2(-1) = 1
Prop2(y := 20) = 1
Prop2(x := 10) = 1
Prop2(y := -2, x := -1) = 1
Prop2(x := -1, y := -2) = 1
Dim foo As IFoo = Me
foo.Prop() = 1
foo.Prop(-1, -2) = 1
foo.Prop(-1) = 1
foo.Prop(y := 20) = 1
foo.Prop(x := 10) = 1
foo.Prop(y := -2, x := -1) = 1
foo.Prop(x := -1, y := -2) = 1
End Sub
End Class", @"
public partial interface IFoo
{
int get_Prop(int x = 1, int y = 2);
void set_Prop(int x = 1, int y = 2, int value = default);
}
public partial class SomeClass : IFoo
{
internal int get_Prop2(int x = 1, int y = 2)
{
return default;
}
internal void set_Prop2(int x = 1, int y = 2, int value = default)
{
}
int IFoo.get_Prop(int x = 1, int y = 2) => get_Prop2(x, y);
void IFoo.set_Prop(int x = 1, int y = 2, int value = default) => set_Prop2(x, y, value);
public void TestGet()
{
IFoo foo = this;
int a = get_Prop2() + get_Prop2(y: 20) + get_Prop2(x: 10) + get_Prop2(y: -2, x: -1) + get_Prop2(x: -1, y: -2);
int b = foo.get_Prop() + foo.get_Prop(y: 20) + foo.get_Prop(x: 10) + foo.get_Prop(y: -2, x: -1) + foo.get_Prop(x: -1, y: -2);
}
public void TestSet()
{
set_Prop2(value: 1);
set_Prop2(-1, -2, 1);
set_Prop2(-1, value: 1);
set_Prop2(y: 20, value: 1);
set_Prop2(x: 10, value: 1);
set_Prop2(y: -2, x: -1, value: 1);
set_Prop2(x: -1, y: -2, value: 1);
IFoo foo = this;
foo.set_Prop(value: 1);
foo.set_Prop(-1, -2, 1);
foo.set_Prop(-1, value: 1);
foo.set_Prop(y: 20, value: 1);
foo.set_Prop(x: 10, value: 1);
foo.set_Prop(y: -2, x: -1, value: 1);
foo.set_Prop(x: -1, y: -2, value: 1);
}
}");
}
[Fact]
public async Task TestParametrizedPropertyCalledWithOmittedArgumentsAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"
Public Interface IFoo
Property Prop(Optional x As Integer = 1, Optional y as Integer = 2, Optional z as Integer = 3) As Integer
End Interface
Public Class SomeClass
Implements IFoo
Friend Property Prop2(Optional x As Integer = 1, Optional y as Integer = 2, Optional z as Integer = 3) As Integer Implements IFoo.Prop
Get
End Get
Set
End Set
End Property
Sub TestGet()
Dim foo As IFoo = Me
Dim a = Prop2(,) + Prop2(, 20) + Prop2(10,) + Prop2(,20,) + Prop2(,,30) + Prop2(10,,) + Prop2(,,)
Dim b = foo.Prop(,) + foo.Prop(, 20) + foo.Prop(10,) + foo.Prop(,20,) + foo.Prop(,,30) + foo.Prop(10,,) + foo.Prop(,,)
End Sub
Sub TestSet()
Prop2(,) = 1
Prop2(, 20) = 1
Prop2(10, ) = 1
Prop2(,20,) = 1
Prop2(,,30) = 1
Prop2(10,,) = 1
Prop2(,,) = 1
Dim foo As IFoo = Me
foo.Prop(,) = 1
foo.Prop(, 20) = 1
foo.Prop(10, ) = 1
foo.Prop(,20,) = 1
foo.Prop(,,30) = 1
foo.Prop(10,,) = 1
foo.Prop(,,) = 1
End Sub
End Class", @"
public partial interface IFoo
{
int get_Prop(int x = 1, int y = 2, int z = 3);
void set_Prop(int x = 1, int y = 2, int z = 3, int value = default);
}
public partial class SomeClass : IFoo
{
internal int get_Prop2(int x = 1, int y = 2, int z = 3)
{
return default;
}
internal void set_Prop2(int x = 1, int y = 2, int z = 3, int value = default)
{
}
int IFoo.get_Prop(int x = 1, int y = 2, int z = 3) => get_Prop2(x, y, z);
void IFoo.set_Prop(int x = 1, int y = 2, int z = 3, int value = default) => set_Prop2(x, y, z, value);
public void TestGet()
{
IFoo foo = this;
int a = get_Prop2() + get_Prop2(y: 20) + get_Prop2(10) + get_Prop2(y: 20) + get_Prop2(z: 30) + get_Prop2(10) + get_Prop2();
int b = foo.get_Prop() + foo.get_Prop(y: 20) + foo.get_Prop(10) + foo.get_Prop(y: 20) + foo.get_Prop(z: 30) + foo.get_Prop(10) + foo.get_Prop();
}
public void TestSet()
{
set_Prop2(value: 1);
set_Prop2(y: 20, value: 1);
set_Prop2(10, value: 1);
set_Prop2(y: 20, value: 1);
set_Prop2(z: 30, value: 1);
set_Prop2(10, value: 1);
set_Prop2(value: 1);
IFoo foo = this;
foo.set_Prop(value: 1);
foo.set_Prop(y: 20, value: 1);
foo.set_Prop(10, value: 1);
foo.set_Prop(y: 20, value: 1);
foo.set_Prop(z: 30, value: 1);
foo.set_Prop(10, value: 1);
foo.set_Prop(value: 1);
}
}");
}
[Fact]
public async Task TestSetWithNamedParameterPropertiesAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Class TestClass
Private _Items As Integer()
Property Items As Integer()
Get
Return _Items
End Get
Set(v As Integer())
_Items = v
End Set
End Property
End Class", @"
internal partial class TestClass
{
private int[] _Items;
public int[] Items
{
get
{
return _Items;
}
set
{
_Items = value;
}
}
}");
}
[Fact]
public async Task TestPropertyAssignmentReturnAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Public Class Class1
Public ReadOnly Property Foo() As String
Get
Foo = """"
End Get
End Property
Public ReadOnly Property X As String
Get
X = 4
X = X * 2
Dim y = ""random variable to check it isn't just using the value of the last statement""
End Get
End Property
Public _y As String
Public WriteOnly Property Y As String
Set(value As String)
If value <> """" Then
Y = """"
Else
_y = """"
End If
End Set
End Property
End Class", @"using Microsoft.VisualBasic.CompilerServices; // Install-Package Microsoft.VisualBasic
public partial class Class1
{
public string Foo
{
get
{
string FooRet = default;
FooRet = """";
return FooRet;
}
}
public string X
{
get
{
string XRet = default;
XRet = 4.ToString();
XRet = (Conversions.ToDouble(XRet) * 2d).ToString();
string y = ""random variable to check it isn't just using the value of the last statement"";
return XRet;
}
}
public string _y;
public string Y
{
set
{
if (!string.IsNullOrEmpty(value))
{
Y = """";
}
else
{
_y = """";
}
}
}
}");
}
[Fact]
public async Task TestGetIteratorDoesNotGainReturnAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Public Class VisualBasicClass
Public Shared ReadOnly Iterator Property SomeObjects As IEnumerable(Of Object())
Get
Yield New Object(2) {}
Yield New Object(2) {}
End Get
End Property
End Class", @"using System.Collections.Generic;
public partial class VisualBasicClass
{
public static IEnumerable<object[]> SomeObjects
{
get
{
yield return new object[3];
yield return new object[3];
}
}
}");
}
/// <summary>Issue #827: VB auto-property backing field access (_Prop) should map to MyClassProp for overridable properties</summary>
[Fact]
public async Task TestOverridableAutoPropertyBackingFieldAccessAsync()
{
await TestConversionVisualBasicToCSharpAsync(@"Class Foo
Overridable Property Prop As Integer = 5
Sub Test()
_Prop = 10
Dim isCorrect = MyClass.Prop = 10
End Sub
End Class
Class Child
Inherits Foo
Overrides Property Prop As Integer = 20
End Class", @"
internal partial class Foo
{
public int MyClassProp { get; set; } = 5;
public virtual int Prop
{
get
{
return MyClassProp;
}
set
{
MyClassProp = value;
}
}
public void Test()
{
MyClassProp = 10;
bool isCorrect = MyClassProp == 10;
}
}
internal partial class Child : Foo
{
public override int Prop { get; set; } = 20;
}");
}
}