コード例 #1
0
        public static List <NonSerializableClass> GenerateListWithBoth()
        {
            var list = NonSerializableClass.GenerateList();

            list.AddRange(GenerateList().Cast <NonSerializableClass>());
            return(list);
        }
 public void EditInDataGridViewTest()
 {
     TestShowInGrid(NonSerializableClass.GenerateList());
     TestShowInGrid(SerializableClass.GenerateList());
     TestShowInGrid(SerializableClass.GenerateListWithBoth());
     TestShowInGrid(SerializableBaseClass.GenerateList());
     TestShowInGrid(SerializableBaseClass2.GenerateListWithBothSerializableClasses());
     TestEditInDataGridView(null);
     TestShowInGrid(Enumerable.Range(1, 100));
 }
        public void DataTableSurrogateSerializeDeserializeTest()
        {
            TestDataTableSurrogateSerializeDeserialize(GeneralHelper.CopyToDataTable(NonSerializableClass.GenerateList()));
            TestDataTableSurrogateSerializeDeserialize(GeneralHelper.CopyToDataTable(SerializableClass.GenerateList()));
            var dt = new DataSet();
            var addressTypeEntityCollection = MetaSingletons.MetaData.AddressType.ToEntityCollection();

            addressTypeEntityCollection.CreateHierarchicalProjection(dt);
            TestDataTableSurrogateSerializeDeserialize(dt.Tables[0]);
            TestDataTableSurrogateSerializeDeserialize(GeneralHelper.CopyToDataTable(MetaDataHelper.GetPropertiesToDisplay(typeof(AddressTypeEntity))));
            //TestDataTableSurrogateSerializeDeserialize(GeneralHelper.CopyToDataTable(MetaSingletons.MetaData.AddressType));
        }
コード例 #4
0
        public void CopyToDataTableTest()
        {
            var listofNonSerializableClasses = NonSerializableClass.GenerateList();

            CopyToDataTableAndAssert(listofNonSerializableClasses);
            CopyToDataTableAndAssert(MetaSingletons.MetaData.AddressType);
            listofNonSerializableClasses.Add(new SerializableClass {
                DateTimeField = DateTime.Now, IntField = listofNonSerializableClasses.Count, StringField = listofNonSerializableClasses.Count.ToString()
            });
            CopyToDataTableAndAssert(listofNonSerializableClasses, typeof(SerializableClass));
            var d = new DataGridView {
                AutoGenerateColumns = true, DataSource = listofNonSerializableClasses
            };

            listofNonSerializableClasses.Insert(0, new SerializableClass {
                DateTimeField = DateTime.Now, IntField = listofNonSerializableClasses.Count, StringField = listofNonSerializableClasses.Count.ToString()
            });
            CopyToDataTableAndAssert(listofNonSerializableClasses, typeof(SerializableClass));
            CopyToDataTableAndAssert(MetaDataHelper.GetPropertiesToSerialize(typeof(AddressTypeEntity)));
        }