public void When_Persisting_Json_Id_Is_Not_Serialized_But_Is_Returned_In_View()
        {
            var key = KeyValueUtils.GenerateKey("json");

            var thing = new Thing { Id = key, SomeProperty = "Foo", SomeOtherProperty = 17};
            var result = Client.ExecuteStoreJson(StoreMode.Set, key, thing, PersistTo.One);
            Assert.That(result.Success, Is.True);

            var obj = Client.ExecuteGet<string>(key);
            Assert.That(obj.Value, Is.Not.StringContaining("\"id\""));

            var savedThing = Client.ExecuteGetJson<Thing>(key);
            Assert.That(savedThing.Value.Id, Is.StringContaining(key));

            var view = Client.GetView<Thing>("things", "all", true);
            foreach (var item in view)
            {
                if (item.Id == key)
                {
                    return;
                }
            }

            Assert.Fail("Id was not returned in view");
        }
        public void When_Serializing_Class_Without_Json_Property_Attributes_Properties_Are_Camel_Cased()
        {
            var thing = new Thing();
            var key = GetUniqueKey();
            var result = _Client.StoreJson(StoreMode.Set, key, thing);

            Assert.That(result, Is.True, "Store failed");

            var savedThing = _Client.Get<string>(key);
            Assert.That(savedThing, Is.StringContaining("someProperty").And.StringContaining("someOtherProperty"));
        }
        public void When_Deserializing_Class_Without_Json_Property_Attributes_Camel_Cased_Properties_Are_Mapped()
        {
            var thing = new Thing { SomeProperty = "foo", SomeOtherProperty = 1 };
            var key = TestUtils.GetUniqueKey();
            var result = Client.StoreJson(StoreMode.Set, key, thing);

            Assert.That(result, Is.True, "Store failed");

            var savedThing = Client.GetJson<Thing>(key);
            Assert.That(savedThing.SomeProperty, Is.StringMatching("foo"));
            Assert.That(savedThing.SomeOtherProperty, Is.EqualTo(1));
        }
        public void When_ExecuteStoringJson_For_A_Class_With_Id_Property_Id_Is_Not_Stored_In_Json()
        {
            var key = KeyValueUtils.GenerateKey("json");

            var thing = new Thing { Id = key, SomeProperty = "Foo", SomeOtherProperty = 17 };
            var result = Client.ExecuteStoreJson(StoreMode.Set, key, thing);
            Assert.That(result.Success, Is.True);

            var obj = Client.ExecuteGet<string>(key);
            Assert.That(obj.Value, Is.Not.StringContaining("\"id\""));

            var savedThing = Client.ExecuteGetJson<Thing>(key);
            Assert.That(savedThing.Value.Id, Is.StringContaining(key));
        }