Commit 1a4903ba authored by luberg's avatar luberg

Issue #111: HashSet with RedisValue.EmptyString do not work as ""

Simple reorder of static field init order fixes this issue.
parent d994b7ad
......@@ -178,8 +178,13 @@ public void TestGet()
var val2 = conn.HashGetAsync("hashkey", "field");
var set2 = conn.HashSetAsync("hashkey", "field-blob", Encoding.UTF8.GetBytes("value3"));
var val3 = conn.HashGetAsync("hashkey", "field-blob");
var val3 = conn.HashGetAsync("hashkey", "field-blob");
var set3 = conn.HashSetAsync("hashkey", "empty_type1", "");
var val4 = conn.HashGetAsync("hashkey", "empty_type1");
var set4 = conn.HashSetAsync("hashkey", "empty_type2", RedisValue.EmptyString);
var val5 = conn.HashGetAsync("hashkey", "empty_type2");
Assert.AreEqual(null, (string)val0.Result);
Assert.AreEqual(true, set0.Result);
Assert.AreEqual("value1", (string)val1.Result);
......@@ -187,8 +192,12 @@ public void TestGet()
Assert.AreEqual("value2", (string)val2.Result);
Assert.AreEqual(true, set2.Result);
Assert.AreEqual("value3", (string)val3.Result);
Assert.AreEqual("value3", (string)val3.Result);
Assert.AreEqual(true, set3.Result);
Assert.AreEqual("", (string)val4.Result);
Assert.AreEqual(true, set4.Result);
Assert.AreEqual("", (string)val5.Result);
}
}
[Test]
......
......@@ -8,14 +8,14 @@ namespace StackExchange.Redis
/// </summary>
public struct RedisValue : IEquatable<RedisValue>, IComparable<RedisValue>, IComparable, IConvertible
{
internal static readonly RedisValue[] EmptyArray = new RedisValue[0];
internal static readonly RedisValue[] EmptyArray = new RedisValue[0];
static readonly byte[] EmptyByteArr = new byte[0];
private static readonly RedisValue
@null = new RedisValue(0, null),
emptyString = new RedisValue(0, EmptyByteArr);
static readonly byte[] EmptyByteArr = new byte[0];
private static readonly byte[] IntegerSentinel = new byte[0];
private readonly byte[] valueBlob;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment