public void SecondaryIndexesAreForcedToLowerCase()
        {
            var obj = new RiakObject(Bucket, Key);

            obj.BinIndex("UPPERCASE").Set("foo");
            obj.IntIndex("MixedCase").Set(10);

            obj.BinIndexes.ContainsKey("uppercase").ShouldBeTrue();
            obj.IntIndexes.ContainsKey("mixedcase").ShouldBeTrue();

            obj.BinIndex("UPPERCASE").Values.First().ShouldEqual("foo");
            obj.BinIndex("uppercase").Values.First().ShouldEqual("foo");
            obj.IntIndex("MixedCase").Values.First().ShouldEqual(10);
            obj.IntIndex("mixedcase").Values.First().ShouldEqual(10);
        }
Beispiel #2
0
        public void QueryingByIntIndexReturnsAListOfKeys()
        {
            for (var i = 0; i < 10; i++)
            {
                var o = new RiakObject(Bucket, Guid.NewGuid().ToString(), "{\"value\":\"this is an object\"}");
                o.IntIndex("age").Set(32, 20);

                Client.Put(o);
            }

            var mr = new RiakMapReduceQuery()
                     .Inputs(RiakIndex.Match(Bucket, "age", 32));

            var result = Client.MapReduce(mr);

            result.IsSuccess.ShouldBeTrue(result.ErrorMessage);

            var keys = result.Value.PhaseResults.SelectMany(x => x.GetObjectIds()).ToList();

            keys.Count().ShouldEqual(10);

            foreach (var key in keys)
            {
                key.Bucket.ShouldNotBeNullOrEmpty();
                key.Key.ShouldNotBeNullOrEmpty();
            }
        }
 public void InvalidFieldNamesAndTypes()
 {
     id = new RiakObjectId("indexes", "mykey", "test value");
     var obj = new RiakObject("indexes", "mykey", "test value");
     var intIdx = obj.IntIndex("test-int-idx");
     Assert.Throws<FormatException>(() => intIdx.Add("invalid-value"));
 }
Beispiel #4
0
        public void Test2iOperations()
        {
            const string indexName = "num";
            const string key1      = "key1";
            const string key2      = "key2";

            var obj1 = new RiakObject(new RiakObjectId(TestBucketType, TestBucket, key1), Value);

            obj1.IntIndex(indexName).Add(1);

            var obj2 = new RiakObject(new RiakObjectId(TestBucketType, TestBucket, key2), Value);

            obj2.IntIndex(indexName).Add(2);

            Client.Put(obj1, new RiakPutOptions().SetDw(3));
            Client.Put(obj2, new RiakPutOptions().SetDw(3));

            // fetch 2i
            var indexId     = new RiakIndexId(TestBucketType, TestBucket, indexName);
            var indexResult = Client.GetSecondaryIndex(indexId, 1, 2, new RiakIndexGetOptions().SetReturnTerms(true));

            indexResult.IsSuccess.ShouldBeTrue();
            var keyTerms = indexResult.Value.IndexKeyTerms.ToList();
            var keys     = keyTerms.Select(t => t.Key).ToList();
            var terms    = keyTerms.Select(t => t.Term).ToList();

            keys.ShouldContain(key1);
            keys.ShouldContain(key2);

            terms.ShouldContain("1");
            terms.ShouldContain("2");
        }
        public void GettingKeysWithReturnTermsDoesAThing()
        {
            var bucket       = Bucket;
            var keysAndTerms = new Dictionary <string, int>();

            for (var i = 0; i < 10; i++)
            {
                var o = new RiakObject(bucket, Guid.NewGuid().ToString(), "{ value: \"this is an object\" }");
                o.IntIndex("sandwiches").Set(i);
                keysAndTerms.Add(o.Key, i);

                Client.Put(o);
            }

            var results = Client.IndexGet(bucket, "sandwiches", 2, 5, new RiakIndexGetOptions().SetReturnTerms(true).SetMaxResults(100).SetStream(false));

            results.IsSuccess.ShouldBeTrue(results.ErrorMessage);
            results.Value.IndexKeyTerms.Count().ShouldEqual(4);

            foreach (var indexResult in results.Value.IndexKeyTerms)
            {
                keysAndTerms.Keys.ShouldContain(indexResult.Key);
                keysAndTerms[indexResult.Key].ShouldEqual(int.Parse(indexResult.Term));
            }
        }
        public void InvalidFieldNamesAndTypes()
        {
            id = new RiakObjectId("indexes", "mykey", "test value");
            var obj    = new RiakObject("indexes", "mykey", "test value");
            var intIdx = obj.IntIndex("test-int-idx");

            Assert.Throws <FormatException>(() => intIdx.Add("invalid-value"));
        }
        public void RiakIndexNameManglingIsHandledAutomatically()
        {
            var riakObject = new RiakObject(Bucket, Key, "value");
            riakObject.BinIndex("name").Set("jeremiah");
            riakObject.BinIndex("state_bin").Set("oregon");
            riakObject.IntIndex("age").Add(32);
            riakObject.IntIndex("cats_int").Add(2);

            riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("name").ShouldBeFalse();
            riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("name_bin").ShouldBeTrue();
            riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("state").ShouldBeFalse();
            riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("state_bin").ShouldBeFalse();
            riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("state_bin_bin").ShouldBeTrue();

            riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("age").ShouldBeFalse();
            riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("age_int").ShouldBeTrue();
            riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("cats").ShouldBeFalse();
            riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("cats_int").ShouldBeFalse();
            riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("cats_int_int").ShouldBeTrue();
        }
        public void RiakIndexNameManglingIsHandledAutomatically()
        {
            var riakObject = new RiakObject(Bucket, Key, "value");

            riakObject.BinIndex("name").Set("jeremiah");
            riakObject.BinIndex("state_bin").Set("oregon");
            riakObject.IntIndex("age").Add(32);
            riakObject.IntIndex("cats_int").Add(2);

            riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("name").ShouldBeFalse();
            riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("name_bin").ShouldBeTrue();
            riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("state").ShouldBeFalse();
            riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("state_bin").ShouldBeFalse();
            riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("state_bin_bin").ShouldBeTrue();

            riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("age").ShouldBeFalse();
            riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("age_int").ShouldBeTrue();
            riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("cats").ShouldBeFalse();
            riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("cats_int").ShouldBeFalse();
            riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("cats_int_int").ShouldBeTrue();
        }
Beispiel #9
0
        private static RiakObject ToRiakObject(Order order)
        {
            var orderRiakObjectId = new RiakObjectId(ordersBucketName, order.Id.ToString());
            var riakObject        = new RiakObject(orderRiakObjectId, order);

            IntIndex salesPersonIdIndex = riakObject.IntIndex(ordersSalesPersonIdIndexName);

            salesPersonIdIndex.Add(order.SalesPersonId.ToString());

            BinIndex orderDateIndex = riakObject.BinIndex(ordersOrderDateIndexName);

            orderDateIndex.Add(order.OrderDate.ToString("yyyy-MM-dd"));

            return(riakObject);
        }
        private ICollection <RiakObjectId> PutObjectsWithIndexValues()
        {
            var ids = new List <RiakObjectId>();

            var larryId = new RiakObjectId("indexes", "people", "larry");
            var larry   = new RiakObject(larryId, "My name is Larry",
                                         RiakConstants.ContentTypes.TextPlain);

            larry.BinIndex("field1").Set("val1");
            larry.IntIndex("field2").Set(1001);

            ids.Add(larryId);
            CheckResult(client.Put(larry));

            var moeId = new RiakObjectId("indexes", "people", "moe");
            var moe   = new RiakObject(moeId, "My name is Moe",
                                       RiakConstants.ContentTypes.TextPlain);

            moe.BinIndex("Field1").Set("val2");
            moe.IntIndex("Field2").Set(1002);

            ids.Add(moeId);
            CheckResult(client.Put(moe));

            var curlyId = new RiakObjectId("indexes", "people", "curly");
            var curly   = new RiakObject(curlyId, "My name is Curly",
                                         RiakConstants.ContentTypes.TextPlain);

            curly.BinIndex("FIELD1").Set("val3");
            curly.IntIndex("FIELD2").Set(1003);

            ids.Add(curlyId);
            CheckResult(client.Put(curly));

            var veronicaId = new RiakObjectId("indexes", "people", "veronica");
            var veronica   = new RiakObject(veronicaId, "My name is Curly",
                                            RiakConstants.ContentTypes.TextPlain);

            veronica.BinIndex("FIELD1").Set(new string[] { "val4", "val4" });
            veronica.IntIndex("FIELD2").Set(new BigInteger[] {
                1004, 1005, 1006, 1004, 1004, 1007
            });

            ids.Add(veronicaId);
            CheckResult(client.Put(veronica));

            return(ids);
        }
        public void IntRangeQueriesReturnMultipleKeys()
        {
            for (var i = 0; i < 10; i++)
            {
                var o = new RiakObject(Bucket, Guid.NewGuid().ToString(), "{ value: \"this is an object\" }");
                o.IntIndex("age").Set(25 + i);

                Client.Put(o);
            }

            var result = Client.IndexGet(Bucket, "age", 27, 30);

            result.IndexKeyTerms.Count().ShouldEqual(4);


            // TODO write tests verifying results
        }
        public void StreamingIndexGetReturnsAllData()
        {
            var bucket = Bucket;

            for (var i = 0; i < 10; i++)
            {
                var o = new RiakObject(bucket, Guid.NewGuid().ToString(), "{ value: \"this is an object\" }");
                o.IntIndex("position").Set(i % 2);

                Client.Put(o, new RiakPutOptions().SetW(RiakConstants.QuorumOptions.All)
                           .SetDw(RiakConstants.QuorumOptions.All));
            }

            var results = Client.StreamIndexGet(bucket, "position", 0);;

            results.IndexKeyTerms.Count().ShouldEqual(5);
        }
        public void IndexesAreSavedWithAnObject()
        {
            var o = new RiakObject(Bucket, "the_object", "{ value: \"this is an object\" }");

            o.BinIndex("tacos").Set("are great!");
            o.IntIndex("age").Set(12);

            Client.Put(o);

            var result = Client.Get(o.ToRiakObjectId());

            result.BinIndexes.Count.ShouldEqual(1);
            result.IntIndexes.Count.ShouldEqual(1);

            result.BinIndex("tacos").Values[0].ShouldEqual("are great!");
            result.IntIndex("age").Values[0].ShouldEqual(12);
        }
Beispiel #14
0
        public void IntRangeQueriesReturnMultipleKeys()
        {
            for (var i = 0; i < 10; i++)
            {
                var o = new RiakObject(Bucket, Guid.NewGuid().ToString(), "{ value: \"this is an object\" }");
                o.IntIndex("age").Set(25 + i);

                Client.Put(o);
            }

            var mr = new RiakMapReduceQuery()
                     .Inputs(RiakIndex.Range(Bucket, "age", 27, 30));

            var result = Client.MapReduce(mr);

            result.IsSuccess.ShouldBeTrue(result.ErrorMessage);
            result.Value.PhaseResults.SelectMany(x => x.GetObjectIds()).Count().ShouldEqual(4);

            // TODO write tests verifying results
        }
        public void GettingKeysWithContinuationDoesNotSetDone()
        {
            var bucket = Bucket;

            for (var i = 0; i < 1000; i++)
            {
                var o = new RiakObject(bucket, Guid.NewGuid().ToString(), "{ value: \"this is an object\" }");
                o.IntIndex("position").Set(i);

                Client.Put(o);
            }

            var results = Client.IndexGet(bucket, "position", 10, 500, new RiakIndexGetOptions().SetMaxResults(10));

            results.IndexKeyTerms.Count().ShouldEqual(10);

            results.Done.ShouldNotEqual(true);
            results.Done.ShouldEqual(false);
            results.Continuation.ShouldNotBeNull();
        }
Beispiel #16
0
        private static RiakObject ToRiakObject(EmpleadoVM empleadoVM)
        {
            var empleadoRiakObjectId = new RiakObjectId(empleadoBucketName, empleadoVM.NumReg.ToString());
            var riakObject           = new RiakObject(empleadoRiakObjectId, empleadoVM);

            BinIndex empleadoNombreIndex = riakObject.BinIndex(empleadoNombreIndexName);

            empleadoNombreIndex.Add(empleadoVM.Nombre);

            if (empleadoVM.Servicio != null)
            {
                BinIndex empleadoSerDescIndex = riakObject.BinIndex(empleadoServicioDescripcionIndexName);
                empleadoSerDescIndex.Add(empleadoVM.Servicio.Descripcion);

                IntIndex empleadoCodSIndex = riakObject.IntIndex(empleadoCodSIndexName);
                empleadoCodSIndex.Add(empleadoVM.Servicio.CodS.ToString());
            }

            return(riakObject);
        }
        public void IntIndexGetReturnsListOfKeys()
        {
            for (var i = 0; i < 10; i++)
            {
                var o = new RiakObject(Bucket, i.ToString(), "{ value: \"this is an object\" }");
                o.IntIndex("age").Add(32);

                Client.Put(o);
            }

            var result = Client.IndexGet(Bucket, "age", 32);

            result.IndexKeyTerms.Count().ShouldEqual(10);

            foreach (var v in result.IndexKeyTerms)
            {
                var key = int.Parse(v.Key);
                key.ShouldBeLessThan(10);
                key.ShouldBeGreaterThan(-1);
            }
        }
        public void IntIndexGetReturnsListOfKeys()
        {
            for (var i = 0; i < 10; i++)
            {
                var o = new RiakObject(Bucket, i.ToString(), "{ value: \"this is an object\" }");
                o.IntIndex("age").Add(32);

                Client.Put(o);
            }

            var result = Client.IndexGet(Bucket, "age", 32);
            result.IsSuccess.ShouldBeTrue(result.ErrorMessage);
            result.Value.Count.ShouldEqual(10);

            foreach (var v in result.Value)
            {
                var key = int.Parse(v);
                key.ShouldBeLessThan(10);
                key.ShouldBeGreaterThan(-1);
            }
        }
        public void GettingKeysWithContinuationDoesNotSetDone()
        {
            var bucket = Bucket;

            for (var i = 0; i < 1000; i++)
            {
                var o = new RiakObject(bucket, Guid.NewGuid().ToString(), "{ value: \"this is an object\" }");
                o.IntIndex("position").Set(i);

                Client.Put(o);
            }

            var results = Client.IndexGet(bucket, "position", 10, 500, new RiakIndexGetOptions().SetMaxResults(10));

            results.IndexKeyTerms.Count().ShouldEqual(10);

            results.Done.ShouldNotEqual(true);
            results.Done.ShouldEqual(false);
            results.Continuation.ShouldNotBeNull();
        }
        public void GettingKeysWithReturnTermsDoesAThing()
        {
            var bucket = Bucket;
            var keysAndTerms = new Dictionary<string, int>();

            for (var i = 0; i < 10; i++)
            {
                var o = new RiakObject(bucket, Guid.NewGuid().ToString(), "{ value: \"this is an object\" }");
                o.IntIndex("sandwiches").Set(i);
                keysAndTerms.Add(o.Key, i);

                Client.Put(o);
            }

            var results = Client.IndexGet(bucket, "sandwiches", 2, 5, new RiakIndexGetOptions().SetReturnTerms(true).SetMaxResults(100).SetStream(false));

            results.IndexKeyTerms.Count().ShouldEqual(4);

            foreach (var indexResult in results.IndexKeyTerms)
            {
                keysAndTerms.Keys.ShouldContain(indexResult.Key);
                keysAndTerms[indexResult.Key].ShouldEqual(int.Parse(indexResult.Term));
            }
        }
        public void IntRangeQueriesReturnMultipleKeys()
        {
            for (var i = 0; i < 10; i++)
            {
                var o = new RiakObject(Bucket, Guid.NewGuid().ToString(), "{ value: \"this is an object\" }");
                o.IntIndex("age").Set(25 + i);

                Client.Put(o);
            }

            var result = Client.IndexGet(Bucket, "age", 27, 30);
            result.IndexKeyTerms.Count().ShouldEqual(4);

            // TODO write tests verifying results
        }
        public void StreamingIndexGetReturnsAllData()
        {
            var bucket = Bucket;

            for (var i = 0; i < 10; i++)
            {
                var o = new RiakObject(bucket, Guid.NewGuid().ToString(), "{ value: \"this is an object\" }");
                o.IntIndex("position").Set(i % 2);

                Client.Put(o, new RiakPutOptions().SetW(RiakConstants.QuorumOptions.All)
                                                  .SetDw(RiakConstants.QuorumOptions.All));
            }

            var results = Client.StreamIndexGet(bucket, "position", 0);;
            results.IndexKeyTerms.Count().ShouldEqual(5);
        }
        public void RiakIndexingSupportsMultipleValuesCorrectly()
        {
            var riakObject = new RiakObject(Bucket, Key, "value");

            riakObject.BinIndex("jobs").Set("dogsbody");
            riakObject.BinIndex("jobs").Values.Count.ShouldEqual(1);

            riakObject.BinIndex("jobs").Add("toilet cleaner", "president", "juggler");
            riakObject.BinIndex("jobs").Values.Count.ShouldEqual(4);

            riakObject.BinIndex("jobs").Remove("dogsbody", "juggler");
            riakObject.BinIndex("jobs").Values.Count.ShouldEqual(2);

            riakObject.BinIndex("jobs").Set("general", "engineer", "cook");
            riakObject.BinIndex("jobs").Values.Count.ShouldEqual(3);
            riakObject.BinIndex("jobs").Values.Contains("general").ShouldBeTrue();

            riakObject.BinIndex("jobs").Clear();
            riakObject.BinIndex("jobs").Values.Count.ShouldEqual(0);

            riakObject.BinIndex("jobs").Delete();
            riakObject.BinIndexes.ContainsKey("jobs").ShouldBeFalse();

            riakObject.IntIndex("years").Set(10);
            riakObject.IntIndex("years").Values.Count.ShouldEqual(1);

            riakObject.IntIndex("years").Add(20, 40, 999);
            riakObject.IntIndex("years").Values.Count.ShouldEqual(4);

            riakObject.IntIndex("years").Remove(40, 999);
            riakObject.IntIndex("years").Values.Count.ShouldEqual(2);

            riakObject.IntIndex("years").Set(51, 52, 53);
            riakObject.IntIndex("years").Values.Count.ShouldEqual(3);
            riakObject.IntIndex("years").Values.Contains(52).ShouldBeTrue();

            riakObject.IntIndex("years").Clear();
            riakObject.IntIndex("years").Values.Count.ShouldEqual(0);

            riakObject.IntIndex("years").Delete();
            riakObject.IntIndexes.ContainsKey("years").ShouldBeFalse();
        }
        public void Test2iOperations()
        {
            const string indexName = "num";
            const string key1 = "key1";
            const string key2 = "key2";

            var obj1 = new RiakObject(new RiakObjectId(TestBucketType, TestBucket, key1), Value);
            obj1.IntIndex(indexName).Add(1);

            var obj2 = new RiakObject(new RiakObjectId(TestBucketType, TestBucket, key2), Value);
            obj2.IntIndex(indexName).Add(2);

            Client.Put(obj1, new RiakPutOptions().SetDw(3));
            Client.Put(obj2, new RiakPutOptions().SetDw(3));

            // fetch 2i
            var indexId = new RiakIndexId(TestBucketType, TestBucket, indexName);
            var indexResult = Client.GetSecondaryIndex(indexId, 1, 2, new RiakIndexGetOptions().SetReturnTerms(true));

            indexResult.IsSuccess.ShouldBeTrue();
            var keyTerms = indexResult.Value.IndexKeyTerms.ToList();
            var keys = keyTerms.Select(t => t.Key).ToList();
            var terms = keyTerms.Select(t => t.Term).ToList();

            keys.ShouldContain(key1);
            keys.ShouldContain(key2);

            terms.ShouldContain("1");
            terms.ShouldContain("2");
        }
        public void IndexesAreSavedWithAnObject()
        {
            var o = new RiakObject(Bucket, "the_object", "{ value: \"this is an object\" }");
            o.BinIndex("tacos").Set("are great!");
            o.IntIndex("age").Set(12);

            Client.Put(o);

            var result = Client.Get(o.ToRiakObjectId());

            result.IsSuccess.ShouldBeTrue(result.ErrorMessage);
            var ro = result.Value;

            ro.BinIndexes.Count.ShouldEqual(1);
            ro.IntIndexes.Count.ShouldEqual(1);
        }
        public void QueryingByIntIndexReturnsAListOfKeys()
        {
            for (var i = 0; i < 10; i++)
            {
                var o = new RiakObject(Bucket, Guid.NewGuid().ToString(), "{\"value\":\"this is an object\"}");
                o.IntIndex("age").Set(32, 20);

                Client.Put(o);
            }

            var mr = new RiakMapReduceQuery()
                .Inputs(RiakIndex.Match(Bucket, "age", 32));

            var result = Client.MapReduce(mr);
            result.IsSuccess.ShouldBeTrue(result.ErrorMessage);

            var keys = result.Value.PhaseResults.SelectMany(x => x.GetObjectIds()).ToList();

            keys.Count().ShouldEqual(10);

            foreach (var key in keys)
            {
                key.Bucket.ShouldNotBeNullOrEmpty();
                key.Key.ShouldNotBeNullOrEmpty();
            }
        }
        private ICollection<RiakObjectId> PutObjectsWithIndexValues()
        {
            var ids = new List<RiakObjectId>();

            var larryId = new RiakObjectId("indexes", "people", "larry");
            var larry = new RiakObject(larryId, "My name is Larry",
                RiakConstants.ContentTypes.TextPlain);

            larry.BinIndex("field1").Set("val1");
            larry.IntIndex("field2").Set(1001);

            ids.Add(larryId);
            CheckResult(client.Put(larry));

            var moeId = new RiakObjectId("indexes", "people", "moe");
            var moe = new RiakObject(moeId, "My name is Moe",
                RiakConstants.ContentTypes.TextPlain);

            moe.BinIndex("Field1").Set("val2");
            moe.IntIndex("Field2").Set(1002);

            ids.Add(moeId);
            CheckResult(client.Put(moe));

            var curlyId = new RiakObjectId("indexes", "people", "curly");
            var curly = new RiakObject(curlyId, "My name is Curly",
                RiakConstants.ContentTypes.TextPlain);

            curly.BinIndex("FIELD1").Set("val3");
            curly.IntIndex("FIELD2").Set(1003);

            ids.Add(curlyId);
            CheckResult(client.Put(curly));

            var veronicaId = new RiakObjectId("indexes", "people", "veronica");
            var veronica = new RiakObject(veronicaId, "My name is Curly",
                RiakConstants.ContentTypes.TextPlain);

            veronica.BinIndex("FIELD1").Set(new string[] { "val4", "val4" });
            veronica.IntIndex("FIELD2").Set(new BigInteger[] {
                1004, 1005, 1006, 1004, 1004, 1007
            });

            ids.Add(veronicaId);
            CheckResult(client.Put(veronica));

            return ids;
        }
        public void SecondaryIndexesAreForcedToLowerCase()
        {
            var obj = new RiakObject(Bucket, Key);

            obj.BinIndex("UPPERCASE").Set("foo");
            obj.IntIndex("MixedCase").Set(10);

            obj.BinIndexes.ContainsKey("uppercase").ShouldBeTrue();
            obj.IntIndexes.ContainsKey("mixedcase").ShouldBeTrue();

            obj.BinIndex("UPPERCASE").Values.First().ShouldEqual("foo");
            obj.BinIndex("uppercase").Values.First().ShouldEqual("foo");
            obj.IntIndex("MixedCase").Values.First().ShouldEqual(10);
            obj.IntIndex("mixedcase").Values.First().ShouldEqual(10);
        }
        public void RiakIndexingSupportsMultipleValuesCorrectly()
        {
            var riakObject = new RiakObject(Bucket, Key, "value");

            riakObject.BinIndex("jobs").Set("dogsbody");
            riakObject.BinIndex("jobs").Values.Count.ShouldEqual(1);

            riakObject.BinIndex("jobs").Add("toilet cleaner", "president", "juggler");
            riakObject.BinIndex("jobs").Values.Count.ShouldEqual(4);

            riakObject.BinIndex("jobs").Remove("dogsbody", "juggler");
            riakObject.BinIndex("jobs").Values.Count.ShouldEqual(2);

            riakObject.BinIndex("jobs").Set("general", "engineer", "cook");
            riakObject.BinIndex("jobs").Values.Count.ShouldEqual(3);
            riakObject.BinIndex("jobs").Values.Contains("general").ShouldBeTrue();

            riakObject.BinIndex("jobs").Clear();
            riakObject.BinIndex("jobs").Values.Count.ShouldEqual(0);

            riakObject.BinIndex("jobs").Delete();
            riakObject.BinIndexes.ContainsKey("jobs").ShouldBeFalse();

            riakObject.IntIndex("years").Set(10);
            riakObject.IntIndex("years").Values.Count.ShouldEqual(1);

            riakObject.IntIndex("years").Add(20, 40, 999);
            riakObject.IntIndex("years").Values.Count.ShouldEqual(4);

            riakObject.IntIndex("years").Remove(40, 999);
            riakObject.IntIndex("years").Values.Count.ShouldEqual(2);

            riakObject.IntIndex("years").Set(51, 52, 53);
            riakObject.IntIndex("years").Values.Count.ShouldEqual(3);
            riakObject.IntIndex("years").Values.Contains(52).ShouldBeTrue();

            riakObject.IntIndex("years").Clear();
            riakObject.IntIndex("years").Values.Count.ShouldEqual(0);

            riakObject.IntIndex("years").Delete();
            riakObject.IntIndexes.ContainsKey("years").ShouldBeFalse();
        }
        public void IntRangeQueriesReturnMultipleKeys()
        {
            for (var i = 0; i < 10; i++)
            {
                var o = new RiakObject(Bucket, Guid.NewGuid().ToString(), "{ value: \"this is an object\" }");
                o.IntIndex("age").Set(25 + i);

                Client.Put(o);
            }

            var mr = new RiakMapReduceQuery()
                .Inputs(RiakIndex.Range(Bucket, "age", 27, 30));

            var result = Client.MapReduce(mr);
            result.IsSuccess.ShouldBeTrue(result.ErrorMessage);
            result.Value.PhaseResults.SelectMany(x => x.GetObjectIds()).Count().ShouldEqual(4);

            // TODO write tests verifying results
        }