Inheritance: global::ProtoBuf.IExtensible
Exemplo n.º 1
0
        public void Should_Construct_CounterResponse_From_DtFetchResp()
        {
            var value = new DtValue();
            value.counter_value = 42;

            var fetchResp = new DtFetchResp();
            fetchResp.value = value;
            fetchResp.type = DtFetchResp.DataType.COUNTER;

            var fetch = new FetchCounter.Builder()
                .WithBucketType(BucketType)
                .WithBucket(Bucket)
                .WithKey(Key)
                .Build();

            fetch.OnSuccess(fetchResp);

            Assert.AreEqual(42, fetch.Response.Value);
        }
Exemplo n.º 2
0
        public void Should_Construct_SetResponse_From_DtFetchResp()
        {
            var set_item_1 = new RiakString("set_item_1");
            var set_item_2 = new RiakString("set_item_2");
            var value = new DtValue();
            value.set_value.Add(set_item_1);
            value.set_value.Add(set_item_2);

            var fetchResp = new DtFetchResp();
            fetchResp.value = value;
            fetchResp.type = DtFetchResp.DataType.SET;

            var fetch = new FetchSet.Builder()
                .WithBucketType(BucketType)
                .WithBucket(Bucket)
                .WithKey(Key)
                .Build();

            fetch.OnSuccess(fetchResp);

            var itemList = fetch.Response.Value.Select(v => new RiakString(v)).ToList();
            Assert.AreEqual(set_item_1, itemList[0]);
            Assert.AreEqual(set_item_2, itemList[1]);
        }