Esempio n. 1
0
        public void TestBLPopWithKey()
        {
            string reply = "*2\r\n$4\r\ntest\r\n$5\r\ntest1\r\n";
            using (var mock = new FakeRedisSocket(reply, reply))
            using (var redis = new RedisClient(mock, new DnsEndPoint("fakehost", 9999)))
            {
                var response1 = redis.BLPopWithKey(60, "test");
                Assert.AreEqual("test", response1.Item1);
                Assert.AreEqual("test1", response1.Item2);
                Assert.AreEqual("*3\r\n$5\r\nBLPOP\r\n$4\r\ntest\r\n$2\r\n60\r\n", mock.GetMessage());

                var response2 = redis.BLPopWithKey(TimeSpan.FromMinutes(1), "test");
                Assert.AreEqual("*3\r\n$5\r\nBLPOP\r\n$4\r\ntest\r\n$2\r\n60\r\n", mock.GetMessage());
            }
        }
Esempio n. 2
0
        public void TestBLPopWithKey()
        {
            string reply = "*2\r\n$4\r\ntest\r\n$5\r\ntest1\r\n";

            using (var mock = new FakeRedisSocket(reply, reply))
                using (var redis = new RedisClient(mock, new DnsEndPoint("fakehost", 9999)))
                {
                    var response1 = redis.BLPopWithKey(60, "test");
                    Assert.Equal("test", response1.Item1);
                    Assert.Equal("test1", response1.Item2);
                    Assert.Equal("*3\r\n$5\r\nBLPOP\r\n$4\r\ntest\r\n$2\r\n60\r\n", mock.GetMessage());

                    var response2 = redis.BLPopWithKey(TimeSpan.FromMinutes(1), "test");
                    Assert.Equal("*3\r\n$5\r\nBLPOP\r\n$4\r\ntest\r\n$2\r\n60\r\n", mock.GetMessage());
                }
        }
Esempio n. 3
0
        public void TestBLPopWithKey()
        {
            string reply = "*2\r\n$4\r\ntest\r\n$5\r\ntest1\r\n";

            using (var mock = new MockConnector("MockHost", 9999, reply, reply))
                using (var redis = new RedisClient(mock))
                {
                    var response1 = redis.BLPopWithKey(60, "test");
                    Assert.AreEqual("test", response1.Item1);
                    Assert.AreEqual("test1", response1.Item2);
                    Assert.AreEqual("*3\r\n$5\r\nBLPOP\r\n$4\r\ntest\r\n$2\r\n60\r\n", mock.GetMessage());

                    var response2 = redis.BLPopWithKey(TimeSpan.FromMinutes(1), "test");
                    Assert.AreEqual("*3\r\n$5\r\nBLPOP\r\n$4\r\ntest\r\n$2\r\n60\r\n", mock.GetMessage());
                }
        }