Inheritance: global::ProtoBuf.IExtensible
        public void Should_Construct_HllResponse_From_DtUpdateResp()
        {
            var key = new RiakString("riak_generated_key");

            var updateResp = new DtUpdateResp();
            updateResp.key = key;
            updateResp.hll_value = 42;

            var update = new UpdateHll.Builder(DefaultAdds)
                .WithBucketType(BucketType)
                .WithBucket(Bucket)
                .Build();

            update.OnSuccess(updateResp);

            HllResponse response = update.Response;

            Assert.NotNull(response);
            Assert.AreEqual(key, response.Key);
            Assert.AreEqual(42, response.Value);
        }
        public void Should_Construct_CounterResponse_From_DtUpdateResp()
        {
            var key = new RiakString("riak_generated_key");
            var context = new RiakString("1234");

            var updateResp = new DtUpdateResp();
            updateResp.key = key;
            updateResp.context = context;
            updateResp.counter_value = DefaultIncrement;

            var update = new UpdateCounter.Builder(DefaultIncrement)
                .WithBucketType(BucketType)
                .WithBucket(Bucket)
                .Build();

            update.OnSuccess(updateResp);

            CounterResponse response = update.Response;

            Assert.NotNull(response);
            Assert.AreEqual(key, response.Key);
            Assert.AreEqual(RiakString.ToBytes(context), response.Context);
            Assert.AreEqual(DefaultIncrement, response.Value);
        }
        public void Should_Construct_SetResponse_From_DtUpdateResp()
        {
            var key = new RiakString("riak_generated_key");

            var updateResp = new DtUpdateResp();
            updateResp.key = key;
            updateResp.context = Context;
            updateResp.set_value.AddRange(DefaultAdds);

            var update = new UpdateSet.Builder(DefaultAdds, null)
                .WithBucketType(BucketType)
                .WithBucket(Bucket)
                .Build();

            update.OnSuccess(updateResp);

            SetResponse response = update.Response;

            Assert.NotNull(response);
            Assert.AreEqual(key, response.Key);
            Assert.AreEqual(Context, response.Context);
            Assert.AreEqual(DefaultAdds, response.Value);
        }
        public void Should_Construct_MapResponse_From_DtUpdateResp()
        {
            var key = new RiakString("riak_generated_key");
            var context = new RiakString("1234");

            var updateResp = new DtUpdateResp();
            updateResp.key = key;
            updateResp.context = context;

            Func<IEnumerable<MapEntry>> createMapEntries = () =>
            {
                var mapEntries = new List<MapEntry>();

                var mapField = new MapField();
                mapField.type = MapField.MapFieldType.COUNTER;
                mapField.name = new RiakString("counter_1");
                var mapEntry = new MapEntry();
                mapEntry.field = mapField;
                mapEntry.counter_value = 50;
                mapEntries.Add(mapEntry);

                mapField = new MapField();
                mapField.type = MapField.MapFieldType.SET;
                mapField.name = new RiakString("set_1");
                mapEntry = new MapEntry();
                mapEntry.field = mapField;
                mapEntry.set_value.Add(RiakString.ToBytes("value_1"));
                mapEntry.set_value.Add(RiakString.ToBytes("value_2"));
                mapEntries.Add(mapEntry);

                mapField = new MapField();
                mapField.type = MapField.MapFieldType.REGISTER;
                mapField.name = new RiakString("register_1");
                mapEntry = new MapEntry();
                mapEntry.field = mapField;
                mapEntry.register_value = RiakString.ToBytes("1234");
                mapEntries.Add(mapEntry);

                mapField = new MapField();
                mapField.type = MapField.MapFieldType.FLAG;
                mapField.name = new RiakString("flag_1");
                mapEntry = new MapEntry();
                mapEntry.field = mapField;
                mapEntry.flag_value = true;
                mapEntries.Add(mapEntry);

                return mapEntries;
            };

            updateResp.map_value.AddRange(createMapEntries());

            var map_1_field = new MapField();
            map_1_field.type = MapField.MapFieldType.MAP;
            map_1_field.name = new RiakString("map_1");
            var map_1_entry = new MapEntry();
            map_1_entry.field = map_1_field;
            map_1_entry.map_value.AddRange(createMapEntries());

            updateResp.map_value.Add(map_1_entry);

            Action<Map> verifyMap = (map) =>
            {
                Assert.AreEqual(50, map.Counters["counter_1"]);
                Assert.AreEqual(RiakString.ToBytes("value_1"), map.Sets["set_1"][0]);
                Assert.AreEqual(RiakString.ToBytes("value_2"), map.Sets["set_1"][1]);
                Assert.AreEqual(RiakString.ToBytes("1234"), map.Registers["register_1"]);
                Assert.IsTrue(map.Flags["flag_1"]);
            };

            var mapOp = new UpdateMap.MapOperation();

            var update = new UpdateMap.Builder(mapOp)
                .WithBucketType("maps")
                .WithBucket("myBucket")
                .WithKey("map_1")
                .Build();

            update.OnSuccess(updateResp);

            MapResponse response = update.Response;

            Assert.NotNull(response);
            Assert.AreEqual(key, response.Key);
            Assert.AreEqual(RiakString.ToBytes(context), response.Context);

            verifyMap(response.Value);
            verifyMap(response.Value.Maps["map_1"]);
        }