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)); }
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]); }
public async Task TestWrongOperation_RPushThrowsException() { Exception thrownException = null; var dut = new AsyncRedisClient(); await dut.Connect(LocalHostDefaultPort.AsConnectionSettings()); try { await dut.Set(ListKey, ListItems[0]); await dut.RPush(ListKey, ListItems); } catch (Exception ex) { thrownException = ex; } Assert.IsNotNull(thrownException); Assert.IsInstanceOfType(thrownException, typeof(RedisException)); }