public void BitPosTest() { using (var mock = new MockConnector("MockHost", 9999, ":10\r\n", ":10\r\n", ":10\r\n")) using (var redis = new RedisClient(mock)) { Assert.AreEqual(10, redis.BitPos("key", true)); Assert.AreEqual("*3\r\n$6\r\nBITPOS\r\n$3\r\nkey\r\n$1\r\n1\r\n", mock.GetMessage()); Assert.AreEqual(10, redis.BitPos("key", true, start: 0)); Assert.AreEqual("*4\r\n$6\r\nBITPOS\r\n$3\r\nkey\r\n$1\r\n1\r\n$1\r\n0\r\n", mock.GetMessage()); Assert.AreEqual(10, redis.BitPos("key", true, start: 0, end: 1)); Assert.AreEqual("*5\r\n$6\r\nBITPOS\r\n$3\r\nkey\r\n$1\r\n1\r\n$1\r\n0\r\n$1\r\n1\r\n", mock.GetMessage()); } }
public void BitPosTest() { using (var mock = new FakeRedisSocket(":10\r\n", ":10\r\n", ":10\r\n")) using (var redis = new RedisClient(mock, new DnsEndPoint("fakehost", 9999))) { Assert.Equal(10, redis.BitPos("key", true)); Assert.Equal("*3\r\n$6\r\nBITPOS\r\n$3\r\nkey\r\n$1\r\n1\r\n", mock.GetMessage()); Assert.Equal(10, redis.BitPos("key", true, start: 0)); Assert.Equal("*4\r\n$6\r\nBITPOS\r\n$3\r\nkey\r\n$1\r\n1\r\n$1\r\n0\r\n", mock.GetMessage()); Assert.Equal(10, redis.BitPos("key", true, start: 0, end: 1)); Assert.Equal("*5\r\n$6\r\nBITPOS\r\n$3\r\nkey\r\n$1\r\n1\r\n$1\r\n0\r\n$1\r\n1\r\n", mock.GetMessage()); } }
public void BitPosTest() { using (var mock = new FakeRedisSocket(":10\r\n", ":10\r\n", ":10\r\n")) using (var redis = new RedisClient(mock, new DnsEndPoint("fakehost", 9999))) { Assert.AreEqual(10, redis.BitPos("key", true)); Assert.AreEqual("*3\r\n$6\r\nBITPOS\r\n$3\r\nkey\r\n$1\r\n1\r\n", mock.GetMessage()); Assert.AreEqual(10, redis.BitPos("key", true, start: 0)); Assert.AreEqual("*4\r\n$6\r\nBITPOS\r\n$3\r\nkey\r\n$1\r\n1\r\n$1\r\n0\r\n", mock.GetMessage()); Assert.AreEqual(10, redis.BitPos("key", true, start: 0, end: 1)); Assert.AreEqual("*5\r\n$6\r\nBITPOS\r\n$3\r\nkey\r\n$1\r\n1\r\n$1\r\n0\r\n$1\r\n1\r\n", mock.GetMessage()); } }
public long StringBitPosition(string key, bool bit, long start = 0, long end = -1) { return(database.BitPos(key, bit, start, end)); }