@@ -150,5 +150,95 @@ public void SkipInheritingRecordsWithProperties(bool skipAutoProps)
150150 File . Delete ( path ) ;
151151 }
152152 }
153+
154+ [ Theory ]
155+ [ InlineData ( true ) ]
156+ [ InlineData ( false ) ]
157+ public void SkipInheritingRecordsWithPropertiesABC ( bool skipAutoProps )
158+ {
159+ string path = Path . GetTempFileName ( ) ;
160+ try
161+ {
162+ FunctionExecutor . RunInProcess ( async ( string [ ] parameters ) =>
163+ {
164+ CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < ClassWithRecordsEmptyPrimaryConstructor > ( instance =>
165+ {
166+ return Task . CompletedTask ;
167+ } ,
168+ persistPrepareResultToFile : parameters [ 0 ] , skipAutoProps : bool . Parse ( parameters [ 1 ] ) ) ;
169+
170+ return 0 ;
171+ } , [ path , skipAutoProps . ToString ( ) ] ) ;
172+
173+ if ( skipAutoProps )
174+ {
175+ TestInstrumentationHelper . GetCoverageResult ( path )
176+ . GenerateReport ( show : true )
177+ . Document ( "Instrumentation.Records.cs" )
178+ . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 39 , 39 )
179+ . AssertNonInstrumentedLines ( BuildConfiguration . Release , 39 , 39 )
180+ . AssertLinesCovered ( BuildConfiguration . Debug , ( 41 , 1 ) , ( 44 , 1 ) , ( 45 , 1 ) , ( 46 , 1 ) )
181+ . AssertLinesCovered ( BuildConfiguration . Release , ( 45 , 1 ) ) ;
182+
183+ }
184+ else
185+ {
186+ TestInstrumentationHelper . GetCoverageResult ( path )
187+ . GenerateReport ( show : true )
188+ . Document ( "Instrumentation.Records.cs" )
189+ . AssertLinesCovered ( BuildConfiguration . Debug , ( 39 , 1 ) , ( 41 , 1 ) , ( 44 , 1 ) , ( 45 , 1 ) , ( 46 , 1 ) )
190+ . AssertLinesCovered ( BuildConfiguration . Release , ( 39 , 1 ) , ( 41 , 1 ) , ( 45 , 1 ) ) ;
191+ }
192+ }
193+ finally
194+ {
195+ File . Delete ( path ) ;
196+ }
197+ }
198+
199+ [ Theory ]
200+ [ InlineData ( true ) ]
201+ [ InlineData ( false ) ]
202+ public void SkipInheritingRecordsWithPropertiesABCDEF ( bool skipAutoProps )
203+ {
204+ string path = Path . GetTempFileName ( ) ;
205+ try
206+ {
207+ FunctionExecutor . RunInProcess ( async ( string [ ] parameters ) =>
208+ {
209+ CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < ClassWithAbstractRecords > ( instance =>
210+ {
211+ return Task . CompletedTask ;
212+ } ,
213+ persistPrepareResultToFile : parameters [ 0 ] , skipAutoProps : bool . Parse ( parameters [ 1 ] ) ) ;
214+
215+ return 0 ;
216+ } , [ path , skipAutoProps . ToString ( ) ] ) ;
217+
218+ if ( skipAutoProps )
219+ {
220+ TestInstrumentationHelper . GetCoverageResult ( path )
221+ . GenerateReport ( show : true )
222+ . Document ( "Instrumentation.Records.cs" )
223+ . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 39 , 39 )
224+ . AssertNonInstrumentedLines ( BuildConfiguration . Release , 39 , 39 )
225+ . AssertLinesCovered ( BuildConfiguration . Debug , ( 41 , 1 ) , ( 44 , 1 ) , ( 45 , 1 ) , ( 46 , 1 ) )
226+ . AssertLinesCovered ( BuildConfiguration . Release , ( 45 , 1 ) ) ;
227+
228+ }
229+ else
230+ {
231+ TestInstrumentationHelper . GetCoverageResult ( path )
232+ . GenerateReport ( show : true )
233+ . Document ( "Instrumentation.Records.cs" )
234+ . AssertLinesCovered ( BuildConfiguration . Debug , ( 39 , 1 ) , ( 41 , 1 ) , ( 44 , 1 ) , ( 45 , 1 ) , ( 46 , 1 ) )
235+ . AssertLinesCovered ( BuildConfiguration . Release , ( 39 , 1 ) , ( 41 , 1 ) , ( 45 , 1 ) ) ;
236+ }
237+ }
238+ finally
239+ {
240+ File . Delete ( path ) ;
241+ }
242+ }
153243 }
154244}
0 commit comments