@@ -21,8 +21,8 @@ public void SkipAutoProps(bool skipAutoProps)
21
21
{
22
22
instance . AutoPropsNonInit = 10 ;
23
23
instance . AutoPropsInit = 20 ;
24
- int readVal = instance . AutoPropsNonInit ;
25
- readVal = instance . AutoPropsInit ;
24
+ int readValue = instance . AutoPropsNonInit ;
25
+ readValue = instance . AutoPropsInit ;
26
26
return Task . CompletedTask ;
27
27
} ,
28
28
persistPrepareResultToFile : parameters [ 0 ] , skipAutoProps : bool . Parse ( parameters [ 1 ] ) ) ;
@@ -33,16 +33,110 @@ public void SkipAutoProps(bool skipAutoProps)
33
33
if ( skipAutoProps )
34
34
{
35
35
TestInstrumentationHelper . GetCoverageResult ( path )
36
- . Document ( "Instrumentation.AutoProps.cs" )
37
- . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 12 , 12 )
38
- . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 7 , 11 )
39
- . AssertLinesCovered ( BuildConfiguration . Debug , ( 13 , 1 ) ) ;
36
+ . Document ( "Instrumentation.AutoProps.cs" )
37
+ . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 12 , 13 )
38
+ . AssertNonInstrumentedLines ( BuildConfiguration . Release , 12 , 13 )
39
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 9 , 11 )
40
+ . AssertLinesCovered ( BuildConfiguration . Debug , ( 7 , 1 ) )
41
+ . AssertLinesCovered ( BuildConfiguration . Release , ( 10 , 1 ) ) ;
40
42
}
41
43
else
42
44
{
43
45
TestInstrumentationHelper . GetCoverageResult ( path )
44
- . Document ( "Instrumentation.AutoProps.cs" )
45
- . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 7 , 13 ) ;
46
+ . Document ( "Instrumentation.AutoProps.cs" )
47
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 7 , 13 )
48
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 10 , 10 )
49
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 12 , 13 ) ;
50
+ }
51
+ }
52
+ finally
53
+ {
54
+ File . Delete ( path ) ;
55
+ }
56
+ }
57
+
58
+ [ Theory ]
59
+ [ InlineData ( true ) ]
60
+ [ InlineData ( false ) ]
61
+ public void SkipAutoPropsInRecords ( bool skipAutoProps )
62
+ {
63
+ string path = Path . GetTempFileName ( ) ;
64
+ try
65
+ {
66
+ FunctionExecutor . Run ( async ( string [ ] parameters ) =>
67
+ {
68
+ CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < RecordWithPropertyInit > ( instance =>
69
+ {
70
+ instance . RecordAutoPropsNonInit = string . Empty ;
71
+ instance . RecordAutoPropsInit = string . Empty ;
72
+ string readValue = instance . RecordAutoPropsInit ;
73
+ readValue = instance . RecordAutoPropsNonInit ;
74
+ return Task . CompletedTask ;
75
+ } ,
76
+ persistPrepareResultToFile : parameters [ 0 ] , skipAutoProps : bool . Parse ( parameters [ 1 ] ) ) ;
77
+
78
+ return 0 ;
79
+ } , new string [ ] { path , skipAutoProps . ToString ( ) } ) ;
80
+
81
+ if ( skipAutoProps )
82
+ {
83
+ TestInstrumentationHelper . GetCoverageResult ( path ) . GenerateReport ( show : true )
84
+ . Document ( "Instrumentation.AutoProps.cs" )
85
+ . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 23 , 24 )
86
+ . AssertNonInstrumentedLines ( BuildConfiguration . Release , 23 , 24 )
87
+ . AssertLinesCovered ( BuildConfiguration . Debug , ( 18 , 1 ) , ( 20 , 1 ) , ( 21 , 1 ) , ( 22 , 1 ) )
88
+ . AssertLinesCovered ( BuildConfiguration . Release , ( 21 , 1 ) ) ;
89
+ }
90
+ else
91
+ {
92
+ TestInstrumentationHelper . GetCoverageResult ( path )
93
+ . Document ( "Instrumentation.AutoProps.cs" )
94
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Debug , 18 , 24 )
95
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 21 , 21 )
96
+ . AssertLinesCoveredFromTo ( BuildConfiguration . Release , 23 , 24 ) ;
97
+ }
98
+ }
99
+ finally
100
+ {
101
+ File . Delete ( path ) ;
102
+ }
103
+ }
104
+
105
+ [ Theory ]
106
+ [ InlineData ( true ) ]
107
+ [ InlineData ( false ) ]
108
+ public void SkipRecordWithProperties ( bool skipAutoProps )
109
+ {
110
+ string path = Path . GetTempFileName ( ) ;
111
+ try
112
+ {
113
+ FunctionExecutor . Run ( async ( string [ ] parameters ) =>
114
+ {
115
+ CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper . Run < ClassWithAutoRecordProperties > ( instance =>
116
+ {
117
+ return Task . CompletedTask ;
118
+ } ,
119
+ persistPrepareResultToFile : parameters [ 0 ] , skipAutoProps : bool . Parse ( parameters [ 1 ] ) ) ;
120
+
121
+ return 0 ;
122
+ } , new string [ ] { path , skipAutoProps . ToString ( ) } ) ;
123
+
124
+ if ( skipAutoProps )
125
+ {
126
+ TestInstrumentationHelper . GetCoverageResult ( path )
127
+ . Document ( "Instrumentation.AutoProps.cs" )
128
+ . AssertNonInstrumentedLines ( BuildConfiguration . Debug , 29 , 29 )
129
+ . AssertNonInstrumentedLines ( BuildConfiguration . Release , 29 , 29 )
130
+ . AssertLinesCovered ( BuildConfiguration . Debug , ( 32 , 1 ) , ( 33 , 1 ) , ( 34 , 1 ) )
131
+ . AssertLinesCovered ( BuildConfiguration . Release , ( 33 , 1 ) ) ;
132
+
133
+ }
134
+ else
135
+ {
136
+ TestInstrumentationHelper . GetCoverageResult ( path )
137
+ . Document ( "Instrumentation.AutoProps.cs" )
138
+ . AssertLinesCovered ( BuildConfiguration . Debug , ( 29 , 3 ) , ( 31 , 1 ) , ( 32 , 1 ) , ( 33 , 1 ) , ( 34 , 1 ) )
139
+ . AssertLinesCovered ( BuildConfiguration . Release , ( 29 , 3 ) , ( 31 , 1 ) , ( 33 , 1 ) ) ;
46
140
}
47
141
}
48
142
finally
0 commit comments