@@ -15,16 +15,16 @@ public abstract class EvaluationStepDefinitionsBase
1515 private readonly ScenarioContext _scenarioContext ;
1616 protected FeatureClient client ;
1717 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 ;
2828 private string contextAwareFlagKey ;
2929 private string contextAwareDefaultValue ;
3030 private string contextAwareValue ;
@@ -49,138 +49,138 @@ public void Givenaproviderisregistered()
4949 }
5050
5151 [ 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 )
5353 {
54- this . booleanFlagValue = client . GetBooleanValueAsync ( flagKey , defaultValue ) ;
54+ this . booleanFlagValue = await client . GetBooleanValueAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
5555 }
5656
5757 [ Then ( @"the resolved boolean value should be ""(.*)""" ) ]
5858 public void Thentheresolvedbooleanvalueshouldbe ( bool expectedValue )
5959 {
60- Assert . Equal ( expectedValue , this . booleanFlagValue . Result ) ;
60+ Assert . Equal ( expectedValue , this . booleanFlagValue ) ;
6161 }
6262
6363 [ 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 )
6565 {
66- this . stringFlagValue = client . GetStringValueAsync ( flagKey , defaultValue ) ;
66+ this . stringFlagValue = await client . GetStringValueAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
6767 }
6868
6969 [ Then ( @"the resolved string value should be ""(.*)""" ) ]
7070 public void Thentheresolvedstringvalueshouldbe ( string expected )
7171 {
72- Assert . Equal ( expected , this . stringFlagValue . Result ) ;
72+ Assert . Equal ( expected , this . stringFlagValue ) ;
7373 }
7474
7575 [ 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 )
7777 {
78- this . intFlagValue = client . GetIntegerValueAsync ( flagKey , defaultValue ) ;
78+ this . intFlagValue = await client . GetIntegerValueAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
7979 }
8080
8181 [ Then ( @"the resolved integer value should be (.*)" ) ]
8282 public void Thentheresolvedintegervalueshouldbe ( int expected )
8383 {
84- Assert . Equal ( expected , this . intFlagValue . Result ) ;
84+ Assert . Equal ( expected , this . intFlagValue ) ;
8585 }
8686
8787 [ 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 )
8989 {
90- this . doubleFlagValue = client . GetDoubleValueAsync ( flagKey , defaultValue ) ;
90+ this . doubleFlagValue = await client . GetDoubleValueAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
9191 }
9292
9393 [ Then ( @"the resolved float value should be (.*)" ) ]
9494 public void Thentheresolvedfloatvalueshouldbe ( double expected )
9595 {
96- Assert . Equal ( expected , this . doubleFlagValue . Result ) ;
96+ Assert . Equal ( expected , this . doubleFlagValue ) ;
9797 }
9898
9999 [ 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 )
101101 {
102- this . objectFlagValue = client . GetObjectValueAsync ( flagKey , new Value ( ) ) ;
102+ this . objectFlagValue = await client . GetObjectValueAsync ( flagKey , new Value ( ) ) . ConfigureAwait ( false ) ;
103103 }
104104
105105 [ Then ( @"the resolved object value should be contain fields ""(.*)"", ""(.*)"", and ""(.*)"", with values ""(.*)"", ""(.*)"" and (.*), respectively" ) ]
106106 public void Thentheresolvedobjectvalueshouldbecontainfieldsandwithvaluesandrespectively ( string boolField , string stringField , string numberField , bool boolValue , string stringValue , int numberValue )
107107 {
108- Value value = this . objectFlagValue . Result ;
108+ Value value = this . objectFlagValue ;
109109 Assert . Equal ( boolValue , value . AsStructure [ boolField ] . AsBoolean ) ;
110110 Assert . Equal ( stringValue , value . AsStructure [ stringField ] . AsString ) ;
111111 Assert . Equal ( numberValue , value . AsStructure [ numberField ] . AsInteger ) ;
112112 }
113113
114114 [ 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 )
116116 {
117- this . booleanFlagDetails = client . GetBooleanDetailsAsync ( flagKey , defaultValue ) ;
117+ this . booleanFlagDetails = await client . GetBooleanDetailsAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
118118 }
119119
120120 [ Then ( @"the resolved boolean details value should be ""(.*)"", the variant should be ""(.*)"", and the reason should be ""(.*)""" ) ]
121121 public void Thentheresolvedbooleandetailsvalueshouldbethevariantshouldbeandthereasonshouldbe ( bool expectedValue , string expectedVariant , string expectedReason )
122122 {
123- var result = this . booleanFlagDetails . Result ;
123+ var result = this . booleanFlagDetails ;
124124 Assert . Equal ( expectedValue , result . Value ) ;
125125 Assert . Equal ( expectedVariant , result . Variant ) ;
126126 Assert . Equal ( expectedReason , result . Reason ) ;
127127 }
128128
129129 [ 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 )
131131 {
132- this . stringFlagDetails = client . GetStringDetailsAsync ( flagKey , defaultValue ) ;
132+ this . stringFlagDetails = await client . GetStringDetailsAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
133133 }
134134
135135 [ Then ( @"the resolved string details value should be ""(.*)"", the variant should be ""(.*)"", and the reason should be ""(.*)""" ) ]
136136 public void Thentheresolvedstringdetailsvalueshouldbethevariantshouldbeandthereasonshouldbe ( string expectedValue , string expectedVariant , string expectedReason )
137137 {
138- var result = this . stringFlagDetails . Result ;
138+ var result = this . stringFlagDetails ;
139139 Assert . Equal ( expectedValue , result . Value ) ;
140140 Assert . Equal ( expectedVariant , result . Variant ) ;
141141 Assert . Equal ( expectedReason , result . Reason ) ;
142142 }
143143
144144 [ 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 )
146146 {
147- this . intFlagDetails = client . GetIntegerDetailsAsync ( flagKey , defaultValue ) ;
147+ this . intFlagDetails = await client . GetIntegerDetailsAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
148148 }
149149
150150 [ Then ( @"the resolved integer details value should be (.*), the variant should be ""(.*)"", and the reason should be ""(.*)""" ) ]
151151 public void Thentheresolvedintegerdetailsvalueshouldbethevariantshouldbeandthereasonshouldbe ( int expectedValue , string expectedVariant , string expectedReason )
152152 {
153- var result = this . intFlagDetails . Result ;
153+ var result = this . intFlagDetails ;
154154 Assert . Equal ( expectedValue , result . Value ) ;
155155 Assert . Equal ( expectedVariant , result . Variant ) ;
156156 Assert . Equal ( expectedReason , result . Reason ) ;
157157 }
158158
159159 [ 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 )
161161 {
162- this . doubleFlagDetails = client . GetDoubleDetailsAsync ( flagKey , defaultValue ) ;
162+ this . doubleFlagDetails = await client . GetDoubleDetailsAsync ( flagKey , defaultValue ) . ConfigureAwait ( false ) ;
163163 }
164164
165165 [ Then ( @"the resolved float details value should be (.*), the variant should be ""(.*)"", and the reason should be ""(.*)""" ) ]
166166 public void Thentheresolvedfloatdetailsvalueshouldbethevariantshouldbeandthereasonshouldbe ( double expectedValue , string expectedVariant , string expectedReason )
167167 {
168- var result = this . doubleFlagDetails . Result ;
168+ var result = this . doubleFlagDetails ;
169169 Assert . Equal ( expectedValue , result . Value ) ;
170170 Assert . Equal ( expectedVariant , result . Variant ) ;
171171 Assert . Equal ( expectedReason , result . Reason ) ;
172172 }
173173
174174 [ 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 )
176176 {
177- this . objectFlagDetails = client . GetObjectDetailsAsync ( flagKey , new Value ( ) ) ;
177+ this . objectFlagDetails = await client . GetObjectDetailsAsync ( flagKey , new Value ( ) ) . ConfigureAwait ( false ) ;
178178 }
179179
180180 [ Then ( @"the resolved object details value should be contain fields ""(.*)"", ""(.*)"", and ""(.*)"", with values ""(.*)"", ""(.*)"" and (.*), respectively" ) ]
181181 public void Thentheresolvedobjectdetailsvalueshouldbecontainfieldsandwithvaluesandrespectively ( string boolField , string stringField , string numberField , bool boolValue , string stringValue , int numberValue )
182182 {
183- Value value = this . objectFlagDetails . Result . Value ;
183+ Value value = this . objectFlagDetails . Value ;
184184 Assert . Equal ( boolValue , value . AsStructure [ boolField ] . AsBoolean ) ;
185185 Assert . Equal ( stringValue , value . AsStructure [ stringField ] . AsString ) ;
186186 Assert . Equal ( numberValue , value . AsStructure [ numberField ] . AsInteger ) ;
@@ -189,8 +189,8 @@ public void Thentheresolvedobjectdetailsvalueshouldbecontainfieldsandwithvaluesa
189189 [ Then ( @"the variant should be ""(.*)"", and the reason should be ""(.*)""" ) ]
190190 public void Giventhevariantshouldbeandthereasonshouldbe ( string expectedVariant , string expectedReason )
191191 {
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 ) ;
194194 }
195195
196196 [ When ( @"context contains keys ""(.*)"", ""(.*)"", ""(.*)"", ""(.*)"" with values ""(.*)"", ""(.*)"", (.*), ""(.*)""" ) ]
@@ -206,11 +206,11 @@ public void Whencontextcontainskeyswithvalues(string field1, string field2, stri
206206 }
207207
208208 [ 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 )
210210 {
211211 contextAwareFlagKey = flagKey ;
212212 contextAwareDefaultValue = defaultValue ;
213- contextAwareValue = client . GetStringValueAsync ( flagKey , contextAwareDefaultValue , context ) . Result ;
213+ contextAwareValue = await client . GetStringValueAsync ( flagKey , contextAwareDefaultValue , context ) . ConfigureAwait ( false ) ;
214214 }
215215
216216 [ Then ( @"the resolved string response should be ""(.*)""" ) ]
@@ -220,18 +220,18 @@ public void Thentheresolvedstringresponseshouldbe(string expected)
220220 }
221221
222222 [ Then ( @"the resolved flag value is ""(.*)"" when the context is empty" ) ]
223- public void Giventheresolvedflagvalueiswhenthecontextisempty ( string expected )
223+ public async Task Giventheresolvedflagvalueiswhenthecontextisempty ( string expected )
224224 {
225- string emptyContextValue = client . GetStringValueAsync ( contextAwareFlagKey , contextAwareDefaultValue , EvaluationContext . Empty ) . Result ;
225+ string emptyContextValue = await client . GetStringValueAsync ( contextAwareFlagKey , contextAwareDefaultValue , EvaluationContext . Empty ) . ConfigureAwait ( false ) ;
226226 Assert . Equal ( expected , emptyContextValue ) ;
227227 }
228228
229229 [ 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 )
231231 {
232232 this . notFoundFlagKey = flagKey ;
233233 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 ) ;
235235 }
236236
237237 [ Then ( @"the default string value should be returned" ) ]
@@ -248,11 +248,11 @@ public void Giventhereasonshouldindicateanerrorandtheerrorcodeshouldindicateamis
248248 }
249249
250250 [ 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 )
252252 {
253253 this . typeErrorFlagKey = flagKey ;
254254 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 ) ;
256256 }
257257
258258 [ Then ( @"the default integer value should be returned" ) ]
@@ -269,7 +269,7 @@ public void Giventhereasonshouldindicateanerrorandtheerrorcodeshouldindicateatyp
269269 }
270270
271271 // convenience method to get the enum description.
272- private string GetErrorTypeDescription ( Enum value )
272+ private static string GetErrorTypeDescription ( Enum value )
273273 {
274274 FieldInfo info = value . GetType ( ) . GetField ( value . ToString ( ) ) ;
275275 DescriptionAttribute [ ] attributes = ( DescriptionAttribute [ ] ) info . GetCustomAttributes ( typeof ( DescriptionAttribute ) ) ;
0 commit comments