@@ -16,19 +16,20 @@ public partial class CoverageTests
16
16
[ Theory ]
17
17
[ InlineData ( true ) ]
18
18
[ InlineData ( false ) ]
19
- public void SkipAutoProps ( bool skipAutoProps )
19
+ public void SkipClassWithAutoProps ( bool skipAutoProps )
20
20
{
21
21
string path = Path . GetTempFileName ( ) ;
22
22
try
23
23
{
24
24
FunctionExecutor . Run ( async ( string [ ] parameters ) =>
25
25
{
26
- CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < AutoProps > ( instance =>
26
+ CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < ClassWithAutoProps > ( instance =>
27
27
{
28
28
instance . AutoPropsNonInit = 10 ;
29
29
instance . AutoPropsInit = 20 ;
30
30
int readValue = instance . AutoPropsNonInit ;
31
31
readValue = instance . AutoPropsInit ;
32
+ readValue = instance . AutoPropsInitKeyword ;
32
33
return Task . CompletedTask ;
33
34
} ,
34
35
persistPrepareResultToFile : parameters [ 0 ] , skipAutoProps : bool . Parse ( parameters [ 1 ] ) ) ;
@@ -40,8 +41,8 @@ public void SkipAutoProps(bool skipAutoProps)
40
41
{
41
42
TestInstrumentationHelper . GetCoverageResult ( path )
42
43
. Document ( "Instrumentation.AutoProps.cs" )
43
- . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 12 , 13 )
44
- . AssertNonInstrumentedLines ( BuildConfiguration . Release , 12 , 13 )
44
+ . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 12 , 14 )
45
+ . AssertNonInstrumentedLines ( BuildConfiguration . Release , 12 , 14 )
45
46
. AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 9 , 11 )
46
47
. AssertLinesCovered ( BuildConfiguration . Debug , ( 7 , 1 ) )
47
48
. AssertLinesCovered ( BuildConfiguration . Release , ( 10 , 1 ) ) ;
@@ -50,9 +51,9 @@ public void SkipAutoProps(bool skipAutoProps)
50
51
{
51
52
TestInstrumentationHelper . GetCoverageResult ( path )
52
53
. Document ( "Instrumentation.AutoProps.cs" )
53
- . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 7 , 13 )
54
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 7 , 14 )
54
55
. AssertLinesCoveredFromTo ( BuildConfiguration . Release , 10 , 10 )
55
- . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 12 , 13 ) ;
56
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 12 , 14 ) ;
56
57
}
57
58
}
58
59
finally
@@ -64,42 +65,39 @@ public void SkipAutoProps(bool skipAutoProps)
64
65
[ Theory ]
65
66
[ InlineData ( true ) ]
66
67
[ InlineData ( false ) ]
67
- public void SkipAutoPropsInRecords ( bool skipAutoProps )
68
+ public void SkipClassWithAutoPropsPrimaryConstructor ( bool skipAutoProps )
68
69
{
69
70
string path = Path . GetTempFileName ( ) ;
70
71
try
71
72
{
72
73
FunctionExecutor . Run ( async ( string [ ] parameters ) =>
73
74
{
74
- CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < RecordWithPropertyInit > ( instance =>
75
- {
76
- instance . RecordAutoPropsNonInit = string . Empty ;
77
- instance . RecordAutoPropsInit = string . Empty ;
78
- string readValue = instance . RecordAutoPropsInit ;
79
- readValue = instance . RecordAutoPropsNonInit ;
80
- return Task . CompletedTask ;
81
- } ,
82
- persistPrepareResultToFile : parameters [ 0 ] , skipAutoProps : bool . Parse ( parameters [ 1 ] ) ) ;
75
+ CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < ClassWithAutoPropsPrimaryConstructor > ( instance =>
76
+ {
77
+ return Task . CompletedTask ;
78
+ } ,
79
+ persistPrepareResultToFile : parameters [ 0 ] , skipAutoProps : bool . Parse ( parameters [ 1 ] ) ) ;
83
80
84
81
return 0 ;
85
82
} , [ path , skipAutoProps . ToString ( ) ] ) ;
86
83
87
84
if ( skipAutoProps )
88
85
{
89
86
TestInstrumentationHelper . GetCoverageResult ( path )
90
- . Document ( "Instrumentation.AutoProps.cs" )
91
- . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 23 , 24 )
92
- . AssertNonInstrumentedLines ( BuildConfiguration . Release , 23 , 24 )
93
- . AssertLinesCovered ( BuildConfiguration . Debug , ( 18 , 1 ) , ( 20 , 1 ) , ( 21 , 1 ) , ( 22 , 1 ) )
94
- . AssertLinesCovered ( BuildConfiguration . Release , ( 21 , 1 ) ) ;
87
+ . Document ( "Instrumentation.AutoProps.cs" )
88
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 28 , 28 )
89
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 28 , 28 )
90
+ . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 30 , 31 , 32 )
91
+ . AssertNonInstrumentedLines ( BuildConfiguration . Release , 30 , 31 , 32 ) ;
95
92
}
96
93
else
97
94
{
98
95
TestInstrumentationHelper . GetCoverageResult ( path )
99
- . Document ( "Instrumentation.AutoProps.cs" )
100
- . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 18 , 24 )
101
- . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 21 , 21 )
102
- . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 23 , 24 ) ;
96
+ . Document ( "Instrumentation.AutoProps.cs" )
97
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 28 , 28 )
98
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 30 , 32 )
99
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 28 , 28 )
100
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 30 , 32 ) ;
103
101
}
104
102
}
105
103
finally
@@ -111,37 +109,44 @@ public void SkipAutoPropsInRecords(bool skipAutoProps)
111
109
[ Theory ]
112
110
[ InlineData ( true ) ]
113
111
[ InlineData ( false ) ]
114
- public void SkipRecordWithProperties ( bool skipAutoProps )
112
+ public void SkipRecordWithAutoProps ( bool skipAutoProps )
115
113
{
116
114
string path = Path . GetTempFileName ( ) ;
117
115
try
118
116
{
119
117
FunctionExecutor . Run ( async ( string [ ] parameters ) =>
120
118
{
121
- CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < ClassWithRecordsAutoProperties > ( instance =>
122
- {
123
- return Task . CompletedTask ;
124
- } ,
125
- persistPrepareResultToFile : parameters [ 0 ] , skipAutoProps : bool . Parse ( parameters [ 1 ] ) ) ;
119
+ CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < RecordWithAutoProps > ( instance =>
120
+ {
121
+ instance . AutoPropsNonInit = 10 ;
122
+ instance . AutoPropsInit = 20 ;
123
+ int readValue = instance . AutoPropsNonInit ;
124
+ readValue = instance . AutoPropsInit ;
125
+ readValue = instance . AutoPropsInitKeyword ;
126
+ return Task . CompletedTask ;
127
+ } ,
128
+ persistPrepareResultToFile : parameters [ 0 ] , skipAutoProps : bool . Parse ( parameters [ 1 ] ) ) ;
126
129
127
130
return 0 ;
128
131
} , [ path , skipAutoProps . ToString ( ) ] ) ;
129
132
130
133
if ( skipAutoProps )
131
134
{
132
135
TestInstrumentationHelper . GetCoverageResult ( path )
133
- . Document ( "Instrumentation.AutoProps.cs" )
134
- . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 29 , 29 )
135
- . AssertNonInstrumentedLines ( BuildConfiguration . Release , 29 , 29 )
136
- . AssertLinesCovered ( BuildConfiguration . Debug , ( 32 , 1 ) , ( 33 , 1 ) , ( 34 , 1 ) )
137
- . AssertLinesCovered ( BuildConfiguration . Release , ( 33 , 1 ) ) ;
136
+ . Document ( "Instrumentation.AutoProps.cs" )
137
+ . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 43 , 45 )
138
+ . AssertNonInstrumentedLines ( BuildConfiguration . Release , 43 , 45 )
139
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 40 , 42 )
140
+ . AssertLinesCovered ( BuildConfiguration . Debug , ( 39 , 1 ) )
141
+ . AssertLinesCovered ( BuildConfiguration . Release , ( 39 , 1 ) ) ;
138
142
}
139
143
else
140
144
{
141
145
TestInstrumentationHelper . GetCoverageResult ( path )
142
- . Document ( "Instrumentation.AutoProps.cs" )
143
- . AssertLinesCovered ( BuildConfiguration . Debug , ( 29 , 1 ) , ( 31 , 1 ) , ( 32 , 1 ) , ( 33 , 1 ) , ( 34 , 1 ) )
144
- . AssertLinesCovered ( BuildConfiguration . Release , ( 29 , 1 ) , ( 31 , 1 ) , ( 33 , 1 ) ) ;
146
+ . Document ( "Instrumentation.AutoProps.cs" )
147
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 38 , 45 ) // go on here
148
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 39 , 39 )
149
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 41 , 45 ) ;
145
150
}
146
151
}
147
152
finally
@@ -153,14 +158,14 @@ public void SkipRecordWithProperties(bool skipAutoProps)
153
158
[ Theory ]
154
159
[ InlineData ( true ) ]
155
160
[ InlineData ( false ) ]
156
- public void SkipInheritingRecordsWithProperties ( bool skipAutoProps )
161
+ public void SkipRecordWithAutoPropsPrimaryConstructor ( bool skipAutoProps )
157
162
{
158
163
string path = Path . GetTempFileName ( ) ;
159
164
try
160
165
{
161
166
FunctionExecutor . Run ( async ( string [ ] parameters ) =>
162
167
{
163
- CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < ClassWithInheritingRecordsAndAutoProperties > ( instance =>
168
+ CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < RecordsWithPrimaryConstructor > ( instance =>
164
169
{
165
170
return Task . CompletedTask ;
166
171
} ,
@@ -173,18 +178,57 @@ public void SkipInheritingRecordsWithProperties(bool skipAutoProps)
173
178
{
174
179
TestInstrumentationHelper . GetCoverageResult ( path )
175
180
. Document ( "Instrumentation.AutoProps.cs" )
176
- . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 39 , 39 )
177
- . AssertNonInstrumentedLines ( BuildConfiguration . Release , 39 , 39 )
178
- . AssertLinesCovered ( BuildConfiguration . Debug , ( 41 , 1 ) , ( 44 , 1 ) , ( 45 , 1 ) , ( 46 , 1 ) )
179
- . AssertLinesCovered ( BuildConfiguration . Release , ( 45 , 1 ) ) ;
181
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 50 , 50 )
182
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 50 , 50 ) ;
183
+ }
184
+ else
185
+ {
186
+ TestInstrumentationHelper . GetCoverageResult ( path )
187
+ . Document ( "Instrumentation.AutoProps.cs" )
188
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 50 , 50 )
189
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 50 , 50 ) ;
190
+ }
191
+ }
192
+ finally
193
+ {
194
+ File . Delete ( path ) ;
195
+ }
196
+ }
180
197
198
+ [ Theory ]
199
+ [ InlineData ( true ) ]
200
+ [ InlineData ( false ) ]
201
+ public void SkipRecordWithAutoPropsPrimaryConstructorMultiline ( bool skipAutoProps )
202
+ {
203
+ string path = Path . GetTempFileName ( ) ;
204
+ try
205
+ {
206
+ FunctionExecutor . Run ( async ( string [ ] parameters ) =>
207
+ {
208
+ CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < RecordsWithPrimaryConstructor > ( instance =>
209
+ {
210
+ return Task . CompletedTask ;
211
+ } ,
212
+ persistPrepareResultToFile : parameters [ 0 ] , skipAutoProps : bool . Parse ( parameters [ 1 ] ) ) ;
213
+
214
+ return 0 ;
215
+ } , [ path , skipAutoProps . ToString ( ) ] ) ;
216
+
217
+ if ( skipAutoProps )
218
+ {
219
+ TestInstrumentationHelper . GetCoverageResult ( path )
220
+ . Document ( "Instrumentation.AutoProps.cs" )
221
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 52 , 55 )
222
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 52 , 55 ) ;
181
223
}
182
224
else
183
225
{
184
226
TestInstrumentationHelper . GetCoverageResult ( path )
185
227
. Document ( "Instrumentation.AutoProps.cs" )
186
- . AssertLinesCovered ( BuildConfiguration . Debug , ( 39 , 1 ) , ( 41 , 1 ) , ( 44 , 1 ) , ( 45 , 1 ) , ( 46 , 1 ) )
187
- . AssertLinesCovered ( BuildConfiguration . Release , ( 39 , 1 ) , ( 41 , 1 ) , ( 45 , 1 ) ) ;
228
+ . AssertLinesCovered ( BuildConfiguration . Debug , 52 , 55 )
229
+ . AssertLinesNotCovered ( BuildConfiguration . Debug , 53 , 54 )
230
+ . AssertLinesCovered ( BuildConfiguration . Release , 52 , 55 )
231
+ . AssertLinesNotCovered ( BuildConfiguration . Release , 53 , 54 ) ;
188
232
}
189
233
}
190
234
finally
0 commit comments