public void Insert_WithID()
        {
            using (var ds = new SQLiteDatastore())
            {
                ds.CreateDatastore(new TestDBBuilder());

                var ent   = POCOMultiTypeObject.CreateWithID();
                var entID = ent.ID;
                ds.Insert(ent);
                ent.ID.Should().Be(entID);
                ent.ID.Should().NotBeNull();

                var entAgain = ds.From <POCOMultiTypeObject>().Query().Single();
                ent.Should().BeEquivalentTo(entAgain);
            }
        }
Esempio n. 2
0
        public void ReadDataTest()
        {
            var poco = POCOMultiTypeObject.CreateWithID();

            var reader = new TestSupport.ObjectDataReader <POCOMultiTypeObject>(new POCOMultiTypeObject[] { poco });

            Assert.True(reader.Read());

            var description = new EntityDescription(typeof(POCOMultiTypeObject));
            var inflator    = new EntityInflator(reader);

            var data = new POCOMultiTypeObject();

            inflator.ReadData(reader, data, description);

            data.Should().BeEquivalentTo(poco, x =>
                                         x.Excluding(y => y.IgnoredField)
                                         .Excluding(y => y.ListField)
                                         .Excluding(y => y.ArrayField)
                                         .Excluding(y => y.ObjectField)
                                         .Excluding(y => y.StrDateTime) // for some reason this field isn't being reflected properly by the ObjectDataReader
                                         );
        }