public void TryParsePrimitive(object instance, bool isSuccess, object value) { var success = RedisValueExtractor.TryParsePrimitive(instance, out RedisValue result); Assert.AreEqual(isSuccess, success); Assert.AreEqual((RedisValue)(string)value, result); }
private RedisValue GetValue(T instance) { if (!RedisValueExtractor.TryParsePrimitive(instance, out RedisValue redisValue)) { return(serializer.Serialize(instance)); } return(redisValue); }
public void TryParsePrimitiveComplex() { var success = RedisValueExtractor.TryParsePrimitive <int?>(1, out RedisValue result); Assert.AreEqual(true, success); Assert.AreEqual((RedisValue)1, result); success = RedisValueExtractor.TryParsePrimitive <int?>(null, out result); Assert.AreEqual(true, success); Assert.AreEqual(RedisValue.Null, result); }