@@ -13,143 +13,143 @@ namespace Coverlet.CoreCoverage.Tests
1313{
1414 public partial class CoverageTests
1515 {
16- [ Theory ]
17- [ InlineData ( true ) ]
18- [ InlineData ( false ) ]
19- public void SkipAutoPropsInRecords ( bool skipAutoProps )
20- {
21- string path = Path . GetTempFileName ( ) ;
22- try
23- {
24- FunctionExecutor . RunInProcess ( async ( string [ ] parameters ) =>
25- {
26- CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < RecordWithPropertyInit > ( instance =>
27- {
28- instance . RecordAutoPropsNonInit = string . Empty ;
29- instance . RecordAutoPropsInit = string . Empty ;
30- string readValue = instance . RecordAutoPropsInit ;
31- readValue = instance . RecordAutoPropsNonInit ;
32- return Task . CompletedTask ;
33- } ,
34- persistPrepareResultToFile : parameters [ 0 ] , skipAutoProps : bool . Parse ( parameters [ 1 ] ) ) ;
35-
36- return 0 ;
37- } , [ path , skipAutoProps . ToString ( ) ] ) ;
38-
39- if ( skipAutoProps )
40- {
41- TestInstrumentationHelper . GetCoverageResult ( path )
42- . GenerateReport ( show : true )
43- . Document ( "Instrumentation.Records.cs" )
44- . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 12 , 13 )
45- . AssertNonInstrumentedLines ( BuildConfiguration . Release , 12 , 13 )
46- . AssertLinesCovered ( BuildConfiguration . Debug , ( 7 , 1 ) , ( 9 , 1 ) , ( 10 , 1 ) , ( 11 , 1 ) )
47- . AssertLinesCovered ( BuildConfiguration . Release , ( 10 , 1 ) ) ;
48- }
49- else
50- {
51- TestInstrumentationHelper . GetCoverageResult ( path )
52- . GenerateReport ( show : true )
53- . Document ( "Instrumentation.Records.cs" )
54- . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 7 , 13 )
55- . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 10 , 10 )
56- . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 12 , 13 ) ;
57- }
58- }
59- finally
60- {
61- File . Delete ( path ) ;
62- }
63- }
64-
65- [ Theory ]
66- [ InlineData ( true ) ]
67- [ InlineData ( false ) ]
68- public void SkipRecordWithProperties ( bool skipAutoProps )
69- {
70- string path = Path . GetTempFileName ( ) ;
71- try
72- {
73- FunctionExecutor . RunInProcess ( async ( string [ ] parameters ) =>
74- {
75- CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < ClassWithRecordsAutoProperties > ( instance =>
76- {
77- return Task . CompletedTask ;
78- } ,
79- persistPrepareResultToFile : parameters [ 0 ] , skipAutoProps : bool . Parse ( parameters [ 1 ] ) ) ;
80-
81- return 0 ;
82- } , [ path , skipAutoProps . ToString ( ) ] ) ;
83-
84- if ( skipAutoProps )
85- {
86- TestInstrumentationHelper . GetCoverageResult ( path )
87- . GenerateReport ( show : true )
88- . Document ( "Instrumentation.Records.cs" )
89- . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 18 , 18 )
90- . AssertNonInstrumentedLines ( BuildConfiguration . Release , 18 , 18 )
91- . AssertLinesCovered ( BuildConfiguration . Debug , ( 21 , 1 ) , ( 22 , 1 ) , ( 23 , 1 ) )
92- . AssertLinesCovered ( BuildConfiguration . Release , ( 22 , 1 ) ) ;
93- }
94- else
95- {
96- TestInstrumentationHelper . GetCoverageResult ( path )
97- . GenerateReport ( show : true )
98- . Document ( "Instrumentation.Records.cs" )
99- . AssertLinesCovered ( BuildConfiguration . Debug , ( 18 , 1 ) , ( 20 , 1 ) , ( 21 , 1 ) , ( 22 , 1 ) , ( 23 , 1 ) )
100- . AssertLinesCovered ( BuildConfiguration . Release , ( 18 , 1 ) , ( 20 , 1 ) , ( 22 , 1 ) ) ;
101- }
102- }
103- finally
104- {
105- File . Delete ( path ) ;
106- }
107- }
108-
109- [ Theory ]
110- [ InlineData ( true ) ]
111- [ InlineData ( false ) ]
112- public void SkipInheritingRecordsWithProperties ( bool skipAutoProps )
113- {
114- string path = Path . GetTempFileName ( ) ;
115- try
116- {
117- FunctionExecutor . RunInProcess ( async ( string [ ] parameters ) =>
118- {
119- CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < ClassWithInheritingRecordsAndAutoProperties > ( instance =>
120- {
121- return Task . CompletedTask ;
122- } ,
123- persistPrepareResultToFile : parameters [ 0 ] , skipAutoProps : bool . Parse ( parameters [ 1 ] ) ) ;
124-
125- return 0 ;
126- } , [ path , skipAutoProps . ToString ( ) ] ) ;
127-
128- if ( skipAutoProps )
129- {
130- TestInstrumentationHelper . GetCoverageResult ( path )
131- . GenerateReport ( show : true )
132- . Document ( "Instrumentation.Records.cs" )
133- . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 28 , 28 )
134- . AssertNonInstrumentedLines ( BuildConfiguration . Release , 28 , 28 )
135- . AssertLinesCovered ( BuildConfiguration . Debug , ( 30 , 1 ) , ( 33 , 1 ) , ( 34 , 1 ) , ( 35 , 1 ) )
136- . AssertLinesCovered ( BuildConfiguration . Release , ( 34 , 1 ) ) ;
137-
138- }
139- else
140- {
141- TestInstrumentationHelper . GetCoverageResult ( path )
142- . GenerateReport ( show : true )
143- . Document ( "Instrumentation.Records.cs" )
144- . AssertLinesCovered ( BuildConfiguration . Debug , ( 28 , 1 ) , ( 30 , 1 ) , ( 33 , 1 ) , ( 34 , 1 ) , ( 35 , 1 ) )
145- . AssertLinesCovered ( BuildConfiguration . Release , ( 28 , 1 ) , ( 30 , 1 ) , ( 34 , 1 ) ) ;
146- }
147- }
148- finally
149- {
150- File . Delete ( path ) ;
151- }
152- }
16+ // [Theory]
17+ // [InlineData(true)]
18+ // [InlineData(false)]
19+ // public void SkipAutoPropsInRecords(bool skipAutoProps)
20+ // {
21+ // string path = Path.GetTempFileName();
22+ // try
23+ // {
24+ // FunctionExecutor.RunInProcess(async (string[] parameters) =>
25+ // {
26+ // CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<RecordWithPropertyInit>(instance =>
27+ // {
28+ // instance.RecordAutoPropsNonInit = string.Empty;
29+ // instance.RecordAutoPropsInit = string.Empty;
30+ // string readValue = instance.RecordAutoPropsInit;
31+ // readValue = instance.RecordAutoPropsNonInit;
32+ // return Task.CompletedTask;
33+ // },
34+ // persistPrepareResultToFile: parameters[0], skipAutoProps: bool.Parse(parameters[1]));
35+
36+ // return 0;
37+ // }, [path, skipAutoProps.ToString()]);
38+
39+ // if (skipAutoProps)
40+ // {
41+ // TestInstrumentationHelper.GetCoverageResult(path)
42+ // .GenerateReport(show: true)
43+ // .Document("Instrumentation.Records.cs")
44+ // .AssertNonInstrumentedLines(BuildConfiguration.Debug, 12, 13)
45+ // .AssertNonInstrumentedLines(BuildConfiguration.Release, 12, 13)
46+ // .AssertLinesCovered(BuildConfiguration.Debug, (7, 1), (9, 1), (10, 1), (11, 1))
47+ // .AssertLinesCovered(BuildConfiguration.Release, (10, 1));
48+ // }
49+ // else
50+ // {
51+ // TestInstrumentationHelper.GetCoverageResult(path)
52+ // .GenerateReport(show: true)
53+ // .Document("Instrumentation.Records.cs")
54+ // .AssertLinesCoveredFromTo(BuildConfiguration.Debug, 7, 13)
55+ // .AssertLinesCoveredFromTo(BuildConfiguration.Release, 10, 10)
56+ // .AssertLinesCoveredFromTo(BuildConfiguration.Release, 12, 13);
57+ // }
58+ // }
59+ // finally
60+ // {
61+ // File.Delete(path);
62+ // }
63+ // }
64+
65+ // [Theory]
66+ // [InlineData(true)]
67+ // [InlineData(false)]
68+ // public void SkipRecordWithProperties(bool skipAutoProps)
69+ // {
70+ // string path = Path.GetTempFileName();
71+ // try
72+ // {
73+ // FunctionExecutor.RunInProcess(async (string[] parameters) =>
74+ // {
75+ // CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<ClassWithRecordsAutoProperties>(instance =>
76+ // {
77+ // return Task.CompletedTask;
78+ // },
79+ // persistPrepareResultToFile: parameters[0], skipAutoProps: bool.Parse(parameters[1]));
80+
81+ // return 0;
82+ // }, [path, skipAutoProps.ToString()]);
83+
84+ // if (skipAutoProps)
85+ // {
86+ // TestInstrumentationHelper.GetCoverageResult(path)
87+ // .GenerateReport(show: true)
88+ // .Document("Instrumentation.Records.cs")
89+ // .AssertNonInstrumentedLines(BuildConfiguration.Debug, 18, 18)
90+ // .AssertNonInstrumentedLines(BuildConfiguration.Release, 18, 18)
91+ // .AssertLinesCovered(BuildConfiguration.Debug, (21, 1), (22, 1), (23, 1))
92+ // .AssertLinesCovered(BuildConfiguration.Release, (22, 1));
93+ // }
94+ // else
95+ // {
96+ // TestInstrumentationHelper.GetCoverageResult(path)
97+ // .GenerateReport(show: true)
98+ // .Document("Instrumentation.Records.cs")
99+ // .AssertLinesCovered(BuildConfiguration.Debug, (18, 1), (20, 1), (21, 1), (22, 1), (23, 1))
100+ // .AssertLinesCovered(BuildConfiguration.Release, (18, 1), (20, 1), (22, 1));
101+ // }
102+ // }
103+ // finally
104+ // {
105+ // File.Delete(path);
106+ // }
107+ // }
108+
109+ // [Theory]
110+ // [InlineData(true)]
111+ // [InlineData(false)]
112+ // public void SkipInheritingRecordsWithProperties(bool skipAutoProps)
113+ // {
114+ // string path = Path.GetTempFileName();
115+ // try
116+ // {
117+ // FunctionExecutor.RunInProcess(async (string[] parameters) =>
118+ // {
119+ // CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<ClassWithInheritingRecordsAndAutoProperties>(instance =>
120+ // {
121+ // return Task.CompletedTask;
122+ // },
123+ // persistPrepareResultToFile: parameters[0], skipAutoProps: bool.Parse(parameters[1]));
124+
125+ // return 0;
126+ // }, [path, skipAutoProps.ToString()]);
127+
128+ // if (skipAutoProps)
129+ // {
130+ // TestInstrumentationHelper.GetCoverageResult(path)
131+ // .GenerateReport(show: true)
132+ // .Document("Instrumentation.Records.cs")
133+ // .AssertNonInstrumentedLines(BuildConfiguration.Debug, 28, 28)
134+ // .AssertNonInstrumentedLines(BuildConfiguration.Release, 28, 28)
135+ // .AssertLinesCovered(BuildConfiguration.Debug, (30, 1), (33, 1), (34, 1), (35, 1))
136+ // .AssertLinesCovered(BuildConfiguration.Release, (34, 1));
137+
138+ // }
139+ // else
140+ // {
141+ // TestInstrumentationHelper.GetCoverageResult(path)
142+ // .GenerateReport(show: true)
143+ // .Document("Instrumentation.Records.cs")
144+ // .AssertLinesCovered(BuildConfiguration.Debug, (28, 1), (30, 1), (33, 1), (34, 1), (35, 1))
145+ // .AssertLinesCovered(BuildConfiguration.Release, (28, 1), (30, 1), (34, 1));
146+ // }
147+ // }
148+ // finally
149+ // {
150+ // File.Delete(path);
151+ // }
152+ // }
153153
154154 [ Theory ]
155155 [ InlineData ( true ) ]
@@ -196,49 +196,49 @@ public void SkipInheritingRecordsWithPropertiesABC(bool skipAutoProps)
196196 }
197197 }
198198
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 , ( 67 , 1 ) , ( 69 , 1 ) , ( 77 , 1 ) , ( 78 , 1 ) , ( 79 , 1 ) , ( 85 , 1 ) , ( 86 , 1 ) , ( 87 , 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 , ( 59 , 1 ) , ( 66 , 1 ) , ( 67 , 1 ) , ( 69 , 1 ) , ( 77 , 1 ) , ( 78 , 1 ) , ( 79 , 1 ) , ( 85 , 1 ) , ( 86 , 1 ) , ( 87 , 1 ) ) ;
235- //.AssertLinesCovered(BuildConfiguration.Release, (39, 1), (41, 1), (45, 1));
236- }
237- }
238- finally
239- {
240- File . Delete ( path ) ;
241- }
242- }
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, (67, 1), (69, 1), (77, 1), (78, 1), (79, 1), (85, 1), (86, 1), (87, 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, (59, 1), (66, 1), (67, 1), (69, 1), (77, 1), (78, 1), (79, 1), (85, 1), (86, 1), (87, 1));
235+ // //.AssertLinesCovered(BuildConfiguration.Release, (39, 1), (41, 1), (45, 1));
236+ // }
237+ // }
238+ // finally
239+ // {
240+ // File.Delete(path);
241+ // }
242+ // }
243243 }
244244}
0 commit comments