public void TestIntIndexRangeSerializationWithType()
        {
            var input = new RiakIntIndexRangeInput(new RiakIndexId("type", "bucket", "index"), 42, 100);

            var s = Serialize(input.WriteJson);

            Assert.AreEqual(s,
                            "\"inputs\":{\"bucket\":[\"type\",\"bucket\"],\"index\":\"index_int\",\"start\":\"42\",\"end\":\"100\"}");
        }
        public void TestIntIndexRangeSerializationOldInterface()
        {
#pragma warning disable 612, 618
            var input = new RiakIntIndexRangeInput("bucket", "index", 42, 100);
#pragma warning restore 612, 618

            var s = Serialize(input.WriteJson);
            Assert.AreEqual(s,
                            "\"inputs\":{\"bucket\":\"bucket\",\"index\":\"index_int\",\"start\":\"42\",\"end\":\"100\"}");
        }
Пример #3
0
        public void IntRangeQueriesReturnMultipleKeys()
        {
            for (var i = 0; i < 10; i++)
            {
                var o = new RiakObject(Bucket, i.ToString(), "{ value: \"this is an object\" }");
                o.AddIntIndex("age_int", 25 + i);

                Client.Put(o);
            }

            var input = new RiakIntIndexRangeInput(Bucket, "age_int", 27, 30);

            var mr = new RiakMapReduceQuery()
                     .Inputs(input)
                     .ReduceErlang(r => r.ModFun("riak_kv_mapreduce", "reduce_identity").Keep(true));

            var result = Client.MapReduce(mr);

            result.IsSuccess.ShouldBeTrue();

            // TODO write tests verifying results
        }
        public void TestIndexSuffixIsSetCorrectly()
        {
            var input = new RiakIntIndexRangeInput(new RiakIndexId("bucket", "index"), 42, 100);

            input.IndexId.IndexName.EndsWith(RiakConstants.IndexSuffix.Integer).ShouldBeTrue();
        }