Example #1
0
        public void OperateBitAnd()
        {
            if (!args.HasBit)
            {
                return;
            }

            Key key = new Key(args.ns, args.set, "opbkey4");

            client.Delete(null, key);

            byte[] bytes = new byte[] { 0x01, 0x42, 0x03, 0x04, 0x05 };

            client.Put(null, key, new Bin(binName, bytes));

            Record record = client.Operate(null, key,
                                           BitOperation.And(BitPolicy.Default, binName, 23, 9, new byte[] { 0x3C, 0x80 }),
                                           Operation.Get(binName)
                                           );

            AssertRecordFound(key, record);

            IList list = record.GetList(binName);

            byte[] b = (byte[])list[1];
            Assert.IsTrue(Util.ByteArrayEquals(new byte[] { 0x01, 0x42, 0x02, 0x00, 0x05 }, b));
        }