public void UpdateDocument()
        {
            const string sampleKey   = "sample::4567";
            var          currentDate = DateTime.Now;
            const int    updateValue = 234;

            var repo  = new SampleModelRepository();
            var model = new SampleModel
            {
                Key            = sampleKey,
                SampleProperty = 9,
                CreatedAt      = currentDate
            };
            var savedModel = repo.SaveDocument(model);

            savedModel.SampleProperty = updateValue;

            var updatedModel = repo.UpdateDocument(savedModel);

            // ensure the model was updated
            Assert.AreEqual(updateValue, updatedModel.SampleProperty);

            // cleanup after ourselves
            repo.RemoveDocument(sampleKey);
        }
        public void UpdateWithoutRetry()
        {
            const string sampleKey = "sample::0000000000";
            var          repo      = new SampleModelRepository();

            repo.RemoveDocument(sampleKey);

            var model0 = new SampleModel
            {
                Key            = sampleKey,
                SampleProperty = 1
            };

            repo.CreateDocument(model0);

            var model1 = repo.GetDocument(sampleKey);
            var model2 = repo.GetDocument(sampleKey);

            model1.SampleProperty = model0.SampleProperty + 2;
            model1 = repo.SaveDocument(model1);

            model2.SampleProperty = model0.SampleProperty + 1;
            var result = repo.UpdateDocument(model2);

            Assert.AreEqual(3, model1.SampleProperty);
            Assert.AreEqual(2, result.SampleProperty);
            Assert.AreNotEqual(model1.CasValue, result.CasValue);

            repo.RemoveDocument(sampleKey);
        }
        public void UpdateWithoutRetry()
        {
            const string sampleKey = "sample::0000000000";
            var repo = new SampleModelRepository();
            repo.RemoveDocument(sampleKey);

            var model0 = new SampleModel
                {
                    Key = sampleKey,
                    SampleProperty = 1
                };
            repo.CreateDocument(model0);

            var model1 = repo.GetDocument(sampleKey);
            var model2 = repo.GetDocument(sampleKey);

            model1.SampleProperty = model0.SampleProperty + 2;
            model1 = repo.SaveDocument(model1);

            model2.SampleProperty = model0.SampleProperty + 1;
            var result = repo.UpdateDocument(model2);

            Assert.AreEqual(3, model1.SampleProperty);
            Assert.AreEqual(2, result.SampleProperty);
            Assert.AreNotEqual(model1.CasValue, result.CasValue);

            repo.RemoveDocument(sampleKey);
        }
        public void UpdateDocument()
        {
            const string sampleKey = "sample::4567";
            var currentDate = DateTime.Now;
            const int updateValue = 234;

            var repo = new SampleModelRepository();
            var model = new SampleModel
                {
                    Key = sampleKey,
                    SampleProperty = 9,
                    CreatedAt = currentDate
                };
            var savedModel = repo.SaveDocument(model);

            savedModel.SampleProperty = updateValue;

            var updatedModel = repo.UpdateDocument(savedModel);

            // ensure the model was updated
            Assert.AreEqual(updateValue, updatedModel.SampleProperty);

            // cleanup after ourselves
            repo.RemoveDocument(sampleKey);
        }