public void Update_the_historical_record_when_a_history_record_exists()
        {
            var stringDef = new FieldDescriptorRef { ItemType = typeof(string), FieldName = "StringDef" };
            var intDef = new FieldDescriptorRef { ItemType = typeof(int), FieldName = "IntDef" };

            var fieldString = new FieldValue { FieldDescriptorRef = stringDef, Value = "1" };
            var fieldInt = new FieldValue { FieldDescriptorRef = intDef, Value = 2 };

            var record = new Record
            {
                Id = "Record1",
                Fields = new List<FieldValue> { fieldString, fieldInt }
            };

            session.Store(record);
            session.SaveChanges();

            record.Fields[0].Value = "s2";
            session.Store(record);
            session.SaveChanges();

            using (var newSession = ds.OpenSession())
            {
                var history = newSession.Load<RecordHistory>("recordHistory/Record1");
                var recordInner = JsonConvert.DeserializeObject<Record>(history.Record.ToString());

                Assert.AreEqual(recordInner.Fields[0].Value, "s2");
            }
        }
        public void Save_a_copy_of_a_record_when_no_history_record_exists()
        {
            var stringDef = new FieldDescriptorRef { ItemType = typeof(string), FieldName = "StringDef" };
            var intDef = new FieldDescriptorRef { ItemType = typeof(int), FieldName = "IntDef" };

            var fieldString = new FieldValue { FieldDescriptorRef = stringDef, Value = "1" };
            var fieldInt = new FieldValue { FieldDescriptorRef = intDef, Value = 2 };

            var record = new Record
            {
                Id = "Record1",
                Fields = new List<FieldValue> { fieldString, fieldInt }
            };

            session.Store(record);
            session.SaveChanges();

            using (var newSession = ds.OpenSession())
            {
                var history = newSession.Load<RecordHistory>("recordHistory/Record1");
                //var recordInner = JsonConvert.DeserializeObject<Record>(history.Record.ToString());

                Assert.IsNotNull(history);
            }
        }
        public void Test()
        {
            var fieldDefinitionRef = new FieldDescriptorRef { FieldName = "IntDef", ItemType = typeof(string) };
            var fieldValue = new FieldValue { FieldDescriptorRef = fieldDefinitionRef, Value = "1" };

            documentSession.Store(fieldValue);
            documentSession.SaveChanges();
        }