Esempio n. 1
0
        public void TestBRPopLPush()
        {
            string reply = "$5\r\ntest1\r\n";
            using (var mock = new MockConnector("localhost", 9999, reply, reply))
            using (var redis = new RedisClient(mock))
            {
                Assert.Equal("test1", (string)redis.BRPopLPush("test", "new", 60));
                Assert.Equal("*4\r\n$10\r\nBRPOPLPUSH\r\n$4\r\ntest\r\n$3\r\nnew\r\n$2\r\n60\r\n", mock.GetMessage());

                Assert.Equal("test1", (string)redis.BRPopLPush("test", "new", TimeSpan.FromMinutes(1)));
                Assert.Equal("*4\r\n$10\r\nBRPOPLPUSH\r\n$4\r\ntest\r\n$3\r\nnew\r\n$2\r\n60\r\n", mock.GetMessage());
            }
        }
Esempio n. 2
0
        public void TestBRPopLPush()
        {
            string reply = "$5\r\ntest1\r\n";

            using (var mock = new FakeRedisSocket(reply, reply))
                using (var redis = new RedisClient(mock, new DnsEndPoint("fakehost", 9999)))
                {
                    Assert.Equal("test1", redis.BRPopLPush("test", "new", 60));
                    Assert.Equal("*4\r\n$10\r\nBRPOPLPUSH\r\n$4\r\ntest\r\n$3\r\nnew\r\n$2\r\n60\r\n", mock.GetMessage());

                    Assert.Equal("test1", redis.BRPopLPush("test", "new", TimeSpan.FromMinutes(1)));
                    Assert.Equal("*4\r\n$10\r\nBRPOPLPUSH\r\n$4\r\ntest\r\n$3\r\nnew\r\n$2\r\n60\r\n", mock.GetMessage());
                }
        }
Esempio n. 3
0
        public void TestBRPopLPush()
        {
            string reply = "$5\r\ntest1\r\n";

            using (var mock = new MockConnector("MockHost", 9999, reply, reply))
                using (var redis = new RedisClient(mock))
                {
                    Assert.AreEqual("test1", redis.BRPopLPush("test", "new", 60));
                    Assert.AreEqual("*4\r\n$10\r\nBRPOPLPUSH\r\n$4\r\ntest\r\n$3\r\nnew\r\n$2\r\n60\r\n", mock.GetMessage());

                    Assert.AreEqual("test1", redis.BRPopLPush("test", "new", TimeSpan.FromMinutes(1)));
                    Assert.AreEqual("*4\r\n$10\r\nBRPOPLPUSH\r\n$4\r\ntest\r\n$3\r\nnew\r\n$2\r\n60\r\n", mock.GetMessage());
                }
        }
Esempio n. 4
0
        public void TestBRPopLPush()
        {
            string reply = "$5\r\ntest1\r\n";
            using (var mock = new FakeRedisSocket(reply, reply))
            using (var redis = new RedisClient(mock, new DnsEndPoint("fakehost", 9999)))
            {
                Assert.AreEqual("test1", redis.BRPopLPush("test", "new", 60));
                Assert.AreEqual("*4\r\n$10\r\nBRPOPLPUSH\r\n$4\r\ntest\r\n$3\r\nnew\r\n$2\r\n60\r\n", mock.GetMessage());

                Assert.AreEqual("test1", redis.BRPopLPush("test", "new", TimeSpan.FromMinutes(1)));
                Assert.AreEqual("*4\r\n$10\r\nBRPOPLPUSH\r\n$4\r\ntest\r\n$3\r\nnew\r\n$2\r\n60\r\n", mock.GetMessage());
            }
        }