private Key Key(string content) { var key = new Key.Utf8(content); keys.Add(key); return(key); }
public async Task Return_NullString_When_Query_Non_Existing_Key() { var key = new Key.Utf8("key-a"); await connection.ExecuteAsync(new SET(key, "value-a")).ConfigureAwait(false); var values = await connection.ExecuteAsync(new MGET(key, "non-existent-key")).ConfigureAwait(false); values.Should().Equal("value-a", BulkString.Null); }
public async Task Allow_To_Query_Same_Key() { var key = new Key.Utf8("key-a"); await connection.ExecuteAsync(new SET(key, "value-a")).ConfigureAwait(false); var values = await connection.ExecuteAsync(new MGET(key, key)).ConfigureAwait(false); values.Should().Equal("value-a", "value-a"); }
public async Task Return_Single_Key() { var key = new Key.Utf8("key-a"); await connection.ExecuteAsync(new SET(key, "value-a")).ConfigureAwait(false); var values = await connection.ExecuteAsync(new MGET(key)).ConfigureAwait(false); values.Should().Equal("value-a"); }
public async Task Return_Several_Keys() { var key1 = new Key.Utf8("key-1"); var key2 = new Key.Utf8("key-2"); var key3 = new Key.Utf8("key-3"); foreach (var key in new[] { key1, key2, key3 }) { await connection.ExecuteAsync(new SET(key, key.ToString())).ConfigureAwait(false); } var values = await connection.ExecuteAsync(new MGET(key1, key2, key3)).ConfigureAwait(false); values.Should().Equal("key-1", "key-2", "key-3"); }