You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Added the compare version method semantic version methods and lessOrEqual and GreaterOrEqual method
* nit fix
* code refact
* Added Semantic versioning and some unit tests
* Added additional unit tests
* alternate implementation
* Refact and nit fix
* Updated throwing exception
* moved all common logic to single method to avoid code repitetion
* Added documentation
* refactored baseCondition
* replaced assert that with particular expected condition
* added invalid scenarios
* added invalid tests and condition to deal them
Co-authored-by: Sohail Hussain <mirza.sohailhussain@gmail.com>
logger.Log(LogLevel.WARN,$@"Audience condition {this} has an unsupported condition value. You may need to upgrade to a newer release of the Optimizely SDK.");
135
173
returnnull;
@@ -141,24 +179,59 @@ public class BaseCondition : ICondition
141
179
returnnull;
142
180
}
143
181
144
-
if(!Validator.IsNumericType(attributeValue))
182
+
if(!(attributeValueisstring))
145
183
{
146
184
logger.Log(LogLevel.WARN,$@"Audience condition {this} evaluated to UNKNOWN because a value of type ""{attributeValue.GetType().Name}"" was passed for user attribute ""{Name}"".");
logger.Log(LogLevel.WARN,$@"Audience condition {this} evaluated to UNKNOWN because the number value for user attribute ""{Name}"" is not in the range [-2^53, +2^53].");
logger.Log(LogLevel.WARN,$@"Audience condition {this} has an unsupported condition value. You may need to upgrade to a newer release of the Optimizely SDK.");
164
237
returnnull;
@@ -170,24 +243,28 @@ public class BaseCondition : ICondition
170
243
returnnull;
171
244
}
172
245
173
-
if(!Validator.IsNumericType(attributeValue))
246
+
if(!(attributeValueisstring))
174
247
{
175
248
logger.Log(LogLevel.WARN,$@"Audience condition {this} evaluated to UNKNOWN because a value of type ""{attributeValue.GetType().Name}"" was passed for user attribute ""{Name}"".");
logger.Log(LogLevel.WARN,$@"Audience condition {this} evaluated to UNKNOWN because the number value for user attribute ""{Name}"" is not in the range [-2^53, +2^53].");
logger.Log(LogLevel.WARN,$@"Audience condition {this} has an unsupported condition value. You may need to upgrade to a newer release of the Optimizely SDK.");
193
270
returnnull;
@@ -199,24 +276,21 @@ public class BaseCondition : ICondition
199
276
returnnull;
200
277
}
201
278
202
-
if(!(attributeValueisstring))
279
+
if(!Validator.IsNumericType(attributeValue))
203
280
{
204
281
logger.Log(LogLevel.WARN,$@"Audience condition {this} evaluated to UNKNOWN because a value of type ""{attributeValue.GetType().Name}"" was passed for user attribute ""{Name}"".");
logger.Log(LogLevel.WARN,$@"Audience condition {this} evaluated to UNKNOWN because the number value for user attribute ""{Name}"" is not in the range [-2^53, +2^53].");
288
+
returnnull;
289
+
}
290
+
doubleuserValue=Convert.ToDouble(attributeValue);
291
+
doubleconditionalValue=Convert.ToDouble(Value);
211
292
212
-
/// <summary>
213
-
/// Validates the value for exact conditions.
214
-
/// </summary>
215
-
/// <param name="value">Value to validate</param>
216
-
/// <returns>true if the type of value is valid for exact conditions, false otherwise.</returns>
0 commit comments