Exemplo n.º 1
0
        public void ReadPrimaryKeyTest()
        {
            var poco = new POCOMultiTypeObject()
            {
                ID = 1
            };

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

            Assert.True(reader.Read());

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

            inflator.ReadPrimaryKey(reader, description).Should().Be(1);
        }
Exemplo 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
                                         );
        }