Ejemplo n.º 1
0
        public async Task Test_RPush()
        {
            var dut = new AsyncRedisClient();
            await dut.Connect(LocalHostDefaultPort.AsConnectionSettings());

            await dut.RPush(ListKey, ListItems);

            var result = (await dut.LRange(ListKey, 0, 100)).ToList();

            Assert.IsTrue(ListItems.SequenceEqual(result));
        }
Ejemplo n.º 2
0
        public async Task Test_LRange()
        {
            var dut = new AsyncRedisClient();
            await dut.Connect(LocalHostDefaultPort.AsConnectionSettings());

            await dut.RPush(ListKey, ListItems);

            var result = (await dut.LRange(ListKey, 1, 2)).ToList();

            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(ListItems[1], result[0]);
            Assert.AreEqual(ListItems[2], result[1]);
        }
Ejemplo n.º 3
0
        public async Task TestWrongOperation_LRangeThrowsException()
        {
            Exception thrownException = null;

            var dut = new AsyncRedisClient();
            await dut.Connect(LocalHostDefaultPort.AsConnectionSettings());

            try
            {
                await dut.Set(ListKey, ListItems[0]);

                await dut.LRange(ListKey, 0, 1);
            }
            catch (Exception ex)
            {
                thrownException = ex;
            }

            Assert.IsNotNull(thrownException);
            Assert.IsInstanceOfType(thrownException, typeof(RedisException));
        }