@@ -15,16 +15,16 @@ public abstract class EvaluationStepDefinitionsBase
15
15
private readonly ScenarioContext _scenarioContext ;
16
16
protected FeatureClient client ;
17
17
protected FeatureClient name ;
18
- private Task < bool > booleanFlagValue ;
19
- private Task < string > stringFlagValue ;
20
- private Task < int > intFlagValue ;
21
- private Task < double > doubleFlagValue ;
22
- private Task < Value > objectFlagValue ;
23
- private Task < FlagEvaluationDetails < bool > > booleanFlagDetails ;
24
- private Task < FlagEvaluationDetails < string > > stringFlagDetails ;
25
- private Task < FlagEvaluationDetails < int > > intFlagDetails ;
26
- private Task < FlagEvaluationDetails < double > > doubleFlagDetails ;
27
- private Task < FlagEvaluationDetails < Value > > objectFlagDetails ;
18
+ private bool booleanFlagValue ;
19
+ private string stringFlagValue ;
20
+ private int intFlagValue ;
21
+ private double doubleFlagValue ;
22
+ private Value objectFlagValue ;
23
+ private FlagEvaluationDetails < bool > booleanFlagDetails ;
24
+ private FlagEvaluationDetails < string > stringFlagDetails ;
25
+ private FlagEvaluationDetails < int > intFlagDetails ;
26
+ private FlagEvaluationDetails < double > doubleFlagDetails ;
27
+ private FlagEvaluationDetails < Value > objectFlagDetails ;
28
28
private string contextAwareFlagKey ;
29
29
private string contextAwareDefaultValue ;
30
30
private string contextAwareValue ;
@@ -49,138 +49,138 @@ public void Givenaproviderisregistered()
49
49
}
50
50
51
51
[ When ( @"a boolean flag with key ""(.*)"" is evaluated with default value ""(.*)""" ) ]
52
- public void Whenabooleanflagwithkeyisevaluatedwithdefaultvalue ( string flagKey , bool defaultValue )
52
+ public async Task Whenabooleanflagwithkeyisevaluatedwithdefaultvalue ( string flagKey , bool defaultValue )
53
53
{
54
- this . booleanFlagValue = client . GetBooleanValueAsync ( flagKey , defaultValue ) ;
54
+ this . booleanFlagValue = await client . GetBooleanValueAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
55
55
}
56
56
57
57
[ Then ( @"the resolved boolean value should be ""(.*)""" ) ]
58
58
public void Thentheresolvedbooleanvalueshouldbe ( bool expectedValue )
59
59
{
60
- Assert . Equal ( expectedValue , this . booleanFlagValue . Result ) ;
60
+ Assert . Equal ( expectedValue , this . booleanFlagValue ) ;
61
61
}
62
62
63
63
[ When ( @"a string flag with key ""(.*)"" is evaluated with default value ""(.*)""" ) ]
64
- public void Whenastringflagwithkeyisevaluatedwithdefaultvalue ( string flagKey , string defaultValue )
64
+ public async Task Whenastringflagwithkeyisevaluatedwithdefaultvalue ( string flagKey , string defaultValue )
65
65
{
66
- this . stringFlagValue = client . GetStringValueAsync ( flagKey , defaultValue ) ;
66
+ this . stringFlagValue = await client . GetStringValueAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
67
67
}
68
68
69
69
[ Then ( @"the resolved string value should be ""(.*)""" ) ]
70
70
public void Thentheresolvedstringvalueshouldbe ( string expected )
71
71
{
72
- Assert . Equal ( expected , this . stringFlagValue . Result ) ;
72
+ Assert . Equal ( expected , this . stringFlagValue ) ;
73
73
}
74
74
75
75
[ When ( @"an integer flag with key ""(.*)"" is evaluated with default value (.*)" ) ]
76
- public void Whenanintegerflagwithkeyisevaluatedwithdefaultvalue ( string flagKey , int defaultValue )
76
+ public async Task Whenanintegerflagwithkeyisevaluatedwithdefaultvalue ( string flagKey , int defaultValue )
77
77
{
78
- this . intFlagValue = client . GetIntegerValueAsync ( flagKey , defaultValue ) ;
78
+ this . intFlagValue = await client . GetIntegerValueAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
79
79
}
80
80
81
81
[ Then ( @"the resolved integer value should be (.*)" ) ]
82
82
public void Thentheresolvedintegervalueshouldbe ( int expected )
83
83
{
84
- Assert . Equal ( expected , this . intFlagValue . Result ) ;
84
+ Assert . Equal ( expected , this . intFlagValue ) ;
85
85
}
86
86
87
87
[ When ( @"a float flag with key ""(.*)"" is evaluated with default value (.*)" ) ]
88
- public void Whenafloatflagwithkeyisevaluatedwithdefaultvalue ( string flagKey , double defaultValue )
88
+ public async Task Whenafloatflagwithkeyisevaluatedwithdefaultvalue ( string flagKey , double defaultValue )
89
89
{
90
- this . doubleFlagValue = client . GetDoubleValueAsync ( flagKey , defaultValue ) ;
90
+ this . doubleFlagValue = await client . GetDoubleValueAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
91
91
}
92
92
93
93
[ Then ( @"the resolved float value should be (.*)" ) ]
94
94
public void Thentheresolvedfloatvalueshouldbe ( double expected )
95
95
{
96
- Assert . Equal ( expected , this . doubleFlagValue . Result ) ;
96
+ Assert . Equal ( expected , this . doubleFlagValue ) ;
97
97
}
98
98
99
99
[ When ( @"an object flag with key ""(.*)"" is evaluated with a null default value" ) ]
100
- public void Whenanobjectflagwithkeyisevaluatedwithanulldefaultvalue ( string flagKey )
100
+ public async Task Whenanobjectflagwithkeyisevaluatedwithanulldefaultvalue ( string flagKey )
101
101
{
102
- this . objectFlagValue = client . GetObjectValueAsync ( flagKey , new Value ( ) ) ;
102
+ this . objectFlagValue = await client . GetObjectValueAsync ( flagKey , new Value ( ) ) . ConfigureAwait ( false ) ;
103
103
}
104
104
105
105
[ Then ( @"the resolved object value should be contain fields ""(.*)"", ""(.*)"", and ""(.*)"", with values ""(.*)"", ""(.*)"" and (.*), respectively" ) ]
106
106
public void Thentheresolvedobjectvalueshouldbecontainfieldsandwithvaluesandrespectively ( string boolField , string stringField , string numberField , bool boolValue , string stringValue , int numberValue )
107
107
{
108
- Value value = this . objectFlagValue . Result ;
108
+ Value value = this . objectFlagValue ;
109
109
Assert . Equal ( boolValue , value . AsStructure [ boolField ] . AsBoolean ) ;
110
110
Assert . Equal ( stringValue , value . AsStructure [ stringField ] . AsString ) ;
111
111
Assert . Equal ( numberValue , value . AsStructure [ numberField ] . AsInteger ) ;
112
112
}
113
113
114
114
[ When ( @"a boolean flag with key ""(.*)"" is evaluated with details and default value ""(.*)""" ) ]
115
- public void Whenabooleanflagwithkeyisevaluatedwithdetailsanddefaultvalue ( string flagKey , bool defaultValue )
115
+ public async Task Whenabooleanflagwithkeyisevaluatedwithdetailsanddefaultvalue ( string flagKey , bool defaultValue )
116
116
{
117
- this . booleanFlagDetails = client . GetBooleanDetailsAsync ( flagKey , defaultValue ) ;
117
+ this . booleanFlagDetails = await client . GetBooleanDetailsAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
118
118
}
119
119
120
120
[ Then ( @"the resolved boolean details value should be ""(.*)"", the variant should be ""(.*)"", and the reason should be ""(.*)""" ) ]
121
121
public void Thentheresolvedbooleandetailsvalueshouldbethevariantshouldbeandthereasonshouldbe ( bool expectedValue , string expectedVariant , string expectedReason )
122
122
{
123
- var result = this . booleanFlagDetails . Result ;
123
+ var result = this . booleanFlagDetails ;
124
124
Assert . Equal ( expectedValue , result . Value ) ;
125
125
Assert . Equal ( expectedVariant , result . Variant ) ;
126
126
Assert . Equal ( expectedReason , result . Reason ) ;
127
127
}
128
128
129
129
[ When ( @"a string flag with key ""(.*)"" is evaluated with details and default value ""(.*)""" ) ]
130
- public void Whenastringflagwithkeyisevaluatedwithdetailsanddefaultvalue ( string flagKey , string defaultValue )
130
+ public async Task Whenastringflagwithkeyisevaluatedwithdetailsanddefaultvalue ( string flagKey , string defaultValue )
131
131
{
132
- this . stringFlagDetails = client . GetStringDetailsAsync ( flagKey , defaultValue ) ;
132
+ this . stringFlagDetails = await client . GetStringDetailsAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
133
133
}
134
134
135
135
[ Then ( @"the resolved string details value should be ""(.*)"", the variant should be ""(.*)"", and the reason should be ""(.*)""" ) ]
136
136
public void Thentheresolvedstringdetailsvalueshouldbethevariantshouldbeandthereasonshouldbe ( string expectedValue , string expectedVariant , string expectedReason )
137
137
{
138
- var result = this . stringFlagDetails . Result ;
138
+ var result = this . stringFlagDetails ;
139
139
Assert . Equal ( expectedValue , result . Value ) ;
140
140
Assert . Equal ( expectedVariant , result . Variant ) ;
141
141
Assert . Equal ( expectedReason , result . Reason ) ;
142
142
}
143
143
144
144
[ When ( @"an integer flag with key ""(.*)"" is evaluated with details and default value (.*)" ) ]
145
- public void Whenanintegerflagwithkeyisevaluatedwithdetailsanddefaultvalue ( string flagKey , int defaultValue )
145
+ public async Task Whenanintegerflagwithkeyisevaluatedwithdetailsanddefaultvalue ( string flagKey , int defaultValue )
146
146
{
147
- this . intFlagDetails = client . GetIntegerDetailsAsync ( flagKey , defaultValue ) ;
147
+ this . intFlagDetails = await client . GetIntegerDetailsAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
148
148
}
149
149
150
150
[ Then ( @"the resolved integer details value should be (.*), the variant should be ""(.*)"", and the reason should be ""(.*)""" ) ]
151
151
public void Thentheresolvedintegerdetailsvalueshouldbethevariantshouldbeandthereasonshouldbe ( int expectedValue , string expectedVariant , string expectedReason )
152
152
{
153
- var result = this . intFlagDetails . Result ;
153
+ var result = this . intFlagDetails ;
154
154
Assert . Equal ( expectedValue , result . Value ) ;
155
155
Assert . Equal ( expectedVariant , result . Variant ) ;
156
156
Assert . Equal ( expectedReason , result . Reason ) ;
157
157
}
158
158
159
159
[ When ( @"a float flag with key ""(.*)"" is evaluated with details and default value (.*)" ) ]
160
- public void Whenafloatflagwithkeyisevaluatedwithdetailsanddefaultvalue ( string flagKey , double defaultValue )
160
+ public async Task Whenafloatflagwithkeyisevaluatedwithdetailsanddefaultvalue ( string flagKey , double defaultValue )
161
161
{
162
- this . doubleFlagDetails = client . GetDoubleDetailsAsync ( flagKey , defaultValue ) ;
162
+ this . doubleFlagDetails = await client . GetDoubleDetailsAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
163
163
}
164
164
165
165
[ Then ( @"the resolved float details value should be (.*), the variant should be ""(.*)"", and the reason should be ""(.*)""" ) ]
166
166
public void Thentheresolvedfloatdetailsvalueshouldbethevariantshouldbeandthereasonshouldbe ( double expectedValue , string expectedVariant , string expectedReason )
167
167
{
168
- var result = this . doubleFlagDetails . Result ;
168
+ var result = this . doubleFlagDetails ;
169
169
Assert . Equal ( expectedValue , result . Value ) ;
170
170
Assert . Equal ( expectedVariant , result . Variant ) ;
171
171
Assert . Equal ( expectedReason , result . Reason ) ;
172
172
}
173
173
174
174
[ When ( @"an object flag with key ""(.*)"" is evaluated with details and a null default value" ) ]
175
- public void Whenanobjectflagwithkeyisevaluatedwithdetailsandanulldefaultvalue ( string flagKey )
175
+ public async Task Whenanobjectflagwithkeyisevaluatedwithdetailsandanulldefaultvalue ( string flagKey )
176
176
{
177
- this . objectFlagDetails = client . GetObjectDetailsAsync ( flagKey , new Value ( ) ) ;
177
+ this . objectFlagDetails = await client . GetObjectDetailsAsync ( flagKey , new Value ( ) ) . ConfigureAwait ( false ) ;
178
178
}
179
179
180
180
[ Then ( @"the resolved object details value should be contain fields ""(.*)"", ""(.*)"", and ""(.*)"", with values ""(.*)"", ""(.*)"" and (.*), respectively" ) ]
181
181
public void Thentheresolvedobjectdetailsvalueshouldbecontainfieldsandwithvaluesandrespectively ( string boolField , string stringField , string numberField , bool boolValue , string stringValue , int numberValue )
182
182
{
183
- Value value = this . objectFlagDetails . Result . Value ;
183
+ Value value = this . objectFlagDetails . Value ;
184
184
Assert . Equal ( boolValue , value . AsStructure [ boolField ] . AsBoolean ) ;
185
185
Assert . Equal ( stringValue , value . AsStructure [ stringField ] . AsString ) ;
186
186
Assert . Equal ( numberValue , value . AsStructure [ numberField ] . AsInteger ) ;
@@ -189,8 +189,8 @@ public void Thentheresolvedobjectdetailsvalueshouldbecontainfieldsandwithvaluesa
189
189
[ Then ( @"the variant should be ""(.*)"", and the reason should be ""(.*)""" ) ]
190
190
public void Giventhevariantshouldbeandthereasonshouldbe ( string expectedVariant , string expectedReason )
191
191
{
192
- Assert . Equal ( expectedVariant , this . objectFlagDetails . Result . Variant ) ;
193
- Assert . Equal ( expectedReason , this . objectFlagDetails . Result . Reason ) ;
192
+ Assert . Equal ( expectedVariant , this . objectFlagDetails . Variant ) ;
193
+ Assert . Equal ( expectedReason , this . objectFlagDetails . Reason ) ;
194
194
}
195
195
196
196
[ When ( @"context contains keys ""(.*)"", ""(.*)"", ""(.*)"", ""(.*)"" with values ""(.*)"", ""(.*)"", (.*), ""(.*)""" ) ]
@@ -206,11 +206,11 @@ public void Whencontextcontainskeyswithvalues(string field1, string field2, stri
206
206
}
207
207
208
208
[ When ( @"a flag with key ""(.*)"" is evaluated with default value ""(.*)""" ) ]
209
- public void Givenaflagwithkeyisevaluatedwithdefaultvalue ( string flagKey , string defaultValue )
209
+ public async Task Givenaflagwithkeyisevaluatedwithdefaultvalue ( string flagKey , string defaultValue )
210
210
{
211
211
contextAwareFlagKey = flagKey ;
212
212
contextAwareDefaultValue = defaultValue ;
213
- contextAwareValue = client . GetStringValueAsync ( flagKey , contextAwareDefaultValue , context ) . Result ;
213
+ contextAwareValue = await client . GetStringValueAsync ( flagKey , contextAwareDefaultValue , context ) . ConfigureAwait ( false ) ;
214
214
}
215
215
216
216
[ Then ( @"the resolved string response should be ""(.*)""" ) ]
@@ -220,18 +220,18 @@ public void Thentheresolvedstringresponseshouldbe(string expected)
220
220
}
221
221
222
222
[ Then ( @"the resolved flag value is ""(.*)"" when the context is empty" ) ]
223
- public void Giventheresolvedflagvalueiswhenthecontextisempty ( string expected )
223
+ public async Task Giventheresolvedflagvalueiswhenthecontextisempty ( string expected )
224
224
{
225
- string emptyContextValue = client . GetStringValueAsync ( contextAwareFlagKey , contextAwareDefaultValue , EvaluationContext . Empty ) . Result ;
225
+ string emptyContextValue = await client . GetStringValueAsync ( contextAwareFlagKey , contextAwareDefaultValue , EvaluationContext . Empty ) . ConfigureAwait ( false ) ;
226
226
Assert . Equal ( expected , emptyContextValue ) ;
227
227
}
228
228
229
229
[ When ( @"a non-existent string flag with key ""(.*)"" is evaluated with details and a default value ""(.*)""" ) ]
230
- public void Whenanonexistentstringflagwithkeyisevaluatedwithdetailsandadefaultvalue ( string flagKey , string defaultValue )
230
+ public async Task Whenanonexistentstringflagwithkeyisevaluatedwithdetailsandadefaultvalue ( string flagKey , string defaultValue )
231
231
{
232
232
this . notFoundFlagKey = flagKey ;
233
233
this . notFoundDefaultValue = defaultValue ;
234
- this . notFoundDetails = client . GetStringDetailsAsync ( this . notFoundFlagKey , this . notFoundDefaultValue ) . Result ;
234
+ this . notFoundDetails = await client . GetStringDetailsAsync ( this . notFoundFlagKey , this . notFoundDefaultValue ) . ConfigureAwait ( false ) ;
235
235
}
236
236
237
237
[ Then ( @"the default string value should be returned" ) ]
@@ -248,11 +248,11 @@ public void Giventhereasonshouldindicateanerrorandtheerrorcodeshouldindicateamis
248
248
}
249
249
250
250
[ When ( @"a string flag with key ""(.*)"" is evaluated as an integer, with details and a default value (.*)" ) ]
251
- public void Whenastringflagwithkeyisevaluatedasanintegerwithdetailsandadefaultvalue ( string flagKey , int defaultValue )
251
+ public async Task Whenastringflagwithkeyisevaluatedasanintegerwithdetailsandadefaultvalue ( string flagKey , int defaultValue )
252
252
{
253
253
this . typeErrorFlagKey = flagKey ;
254
254
this . typeErrorDefaultValue = defaultValue ;
255
- this . typeErrorDetails = client . GetIntegerDetailsAsync ( this . typeErrorFlagKey , this . typeErrorDefaultValue ) . Result ;
255
+ this . typeErrorDetails = await client . GetIntegerDetailsAsync ( this . typeErrorFlagKey , this . typeErrorDefaultValue ) . ConfigureAwait ( false ) ;
256
256
}
257
257
258
258
[ Then ( @"the default integer value should be returned" ) ]
@@ -269,7 +269,7 @@ public void Giventhereasonshouldindicateanerrorandtheerrorcodeshouldindicateatyp
269
269
}
270
270
271
271
// convenience method to get the enum description.
272
- private string GetErrorTypeDescription ( Enum value )
272
+ private static string GetErrorTypeDescription ( Enum value )
273
273
{
274
274
FieldInfo info = value . GetType ( ) . GetField ( value . ToString ( ) ) ;
275
275
DescriptionAttribute [ ] attributes = ( DescriptionAttribute [ ] ) info . GetCustomAttributes ( typeof ( DescriptionAttribute ) ) ;
0 commit comments