Example #1
0
        public void Can_insert_and_select_from_ModelWithComplexTypes_table()
        {
            using (var db = OpenDbConnection())
            {
                db.CreateTable <ModelWithComplexTypes>(true);

                var row = ModelWithComplexTypes.Create(1);

                db.Insert(row);

                var rows = db.Select <ModelWithComplexTypes>();

                Assert.That(rows, Has.Count.EqualTo(1));

                ModelWithComplexTypes.AssertIsEqual(rows[0], row);
            }
        }
        public void Can_Serialize_NullsWhenNull()
        {
            var m1 = new ModelWithComplexTypes();

            JsConfig.IncludeNullValues = true;
            var s = JsonSerializer.SerializeToString(m1);

            Console.WriteLine(s);

            var m2 = new JavaScriptSerializer().Deserialize <ModelWithComplexTypes>(s);

            JsConfig.Reset();

            Assert.IsNull(m2.DictionaryValue);
            Assert.IsNull(m2.ListValue);
            Assert.IsNull(m2.ArrayValue);
            Assert.IsNull(m2.NestedTypeValue);
            Assert.IsNull(m2.ByteArrayValue);
            Assert.IsNull(m2.DateTimeValue);
        }