Esempio n. 1
0
        public void FillObjectTestSubclassing()
        {
            TesterAllSub tester = new TesterAllSub();

            DataMapper.Default.ClearCache();
            DataMapper.Default.SetConfig(String.Empty);
            DataMapper.Default.GeneratedFileName = "gen.dll";
            DataMapper.Default.FillObject(_DateTable.Rows[0], tester, 0);

            if (tester.ValueProp != 1 ||
                tester.ValuePropNI != true ||
                tester.RefProp != "Hey!" ||
                tester.StructProp != _CurrentDate ||
                tester.NullableProp != _CurrentDate ||
                tester.NullablePropBool != true ||
                tester.TesterArrayList.Count != 2 ||
                tester.TesterList.Count != 2 ||
                tester.CmplProp.StructProp != _CurrentDate
                )
            {
                Assert.Fail("FillObjectTest fails.");
            }

            DataMapper.Default.FillObject(_DateTable.Rows[2], tester, 0);

            if (tester.ValueProp != default(int) ||
                tester.ValuePropNI != default(bool) ||
                tester.RefProp != null ||
                tester.StructProp != default(DateTime) ||
                tester.NullableProp != null ||
                tester.NullablePropBool != null ||
                tester.TesterArrayList.Count != 2 ||
                tester.TesterList.Count != 2 ||
                tester.CmplProp.StructProp != default(DateTime)
                )
            {
                Assert.Fail("FillObjectTest with DBNull fails.");
            }
        }
Esempio n. 2
0
        public void FillObjectTestSubclassing()
        {
            new TesterAllSub();
            DataMapper.Default.ClearCache();
            DataMapper.Default.SetConfig(String.Empty);
            var          reader = _DataSet.CreateDataReader();
            TesterAllSub tester = DataMapper.Default.FillObject <TesterAllSub>(reader, null);

            if (tester.ValueProp != 1 ||
                tester.ValuePropNI != true ||
                tester.RefProp != "Hey!" ||
                tester.StructProp != _CurrentDate ||
                tester.NullableProp != _CurrentDate ||
                tester.NullablePropBool != true ||
                tester.CmplProp.StructProp != _CurrentDate
                )
            {
                Assert.Fail("FillObjectTest fails.");
            }

            reader.Read();             // skip one record
            DataMapper.Default.FillObject(reader, tester, 0);

            if (tester.ValueProp != default(int) ||
                tester.ValuePropNI != default(bool) ||
                tester.RefProp != null ||
                tester.StructProp != default(DateTime) ||
                tester.NullableProp != null ||
                tester.NullablePropBool != null ||
                tester.CmplProp.StructProp != default(DateTime)
                )
            {
                Assert.Fail("FillObjectTest with DBNull fails.");
            }

            reader.Close();
        }