Esempio n. 1
0
        private Key Key(string content)
        {
            var key = new Key.Utf8(content);

            keys.Add(key);
            return(key);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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");
        }
Esempio n. 4
0
        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");
        }
Esempio n. 5
0
        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");
        }