コード例 #1
0
        public void ToBindingListViewTest()
        {
            TestToBindingListView(MetaDataHelper.GetPropertiesToDisplay(typeof(AddressTypeEntity)));
            TestToBindingListView(((IEntity)MetaSingletons.MetaData.AddressType.First()).CustomPropertiesOfType);
            var addressTypeEntityCollection = MetaSingletons.MetaData.AddressType.ToEntityCollection();
            var list = TestToBindingListView(addressTypeEntityCollection.DefaultView);

            Assert.AreEqual(addressTypeEntityCollection.DefaultView, list);

            Assert.AreEqual(addressTypeEntityCollection.DefaultView, TestToBindingListView(addressTypeEntityCollection));
            CollectionAssert.AreEqual(addressTypeEntityCollection, TestToBindingListView(addressTypeEntityCollection.AsQueryable()));
            CollectionAssert.AreEqual(addressTypeEntityCollection, TestToBindingListView(addressTypeEntityCollection.Cast <CommonEntityBase>()));

            TestToBindingListView(MetaSingletons.MetaData.AddressType);

            var dataTable = TestData.GetAddressTypeDataTable();

            Assert.AreEqual(dataTable.DefaultView, TestListSourceToBindingListView(dataTable));

            var enumerable = Enumerable.Range(1, 100);
            var actual     = TestToBindingListView(enumerable);

            CollectionAssert.AreEqual(enumerable.ToList(), actual);

            Assert.IsNull("A string".ToBindingListView());

            Assert.IsNull((new[] { "s1", "s2", "s3" }).ToBindingListView());

            TestToBindingListView(SerializableClass.GenerateList().ToBindingListView());
        }
        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));
        }
コード例 #3
0
        public void NonSerializableItemTest()
        {
            var listofNonSerializableClasses = NonSerializableClass.GenerateList();

            TestSerialize(listofNonSerializableClasses);
            listofNonSerializableClasses.Insert(0, new SerializableClass {
                DateTimeField = DateTime.Now, IntField = listofNonSerializableClasses.Count, StringField = listofNonSerializableClasses.Count.ToString()
            });
            TestSerialize(listofNonSerializableClasses);
            TestSerialize(new ArrayList(listofNonSerializableClasses));
            TestShow(MetaDataHelper.GetPropertiesToDisplay(typeof(AddressTypeEntity)));
        }
        public void FieldsToPropertiesTypeDescriptionProviderTest()
        {
            var properties = MetaDataHelper.GetPropertiesToDisplay(typeof(NonSerializableClass));

            Assert.AreEqual(3, properties.Count());
            AddFieldsToPropertiesTypeDescriptionProvider(typeof(NonSerializableClass));
            try
            {
                properties = MetaDataHelper.GetPropertiesToDisplay(typeof(NonSerializableClass));
                Assert.AreEqual(6, properties.Count());
            }
            finally
            {
                TidyUp(typeof(NonSerializableClass));
            }
        }
コード例 #5
0
 public LLBLMemberProvider(object objectToWrite, Type itemType)
 {
     _objectToWrite = objectToWrite;
     _propsToWrite  = MetaDataHelper.GetPropertiesToDisplay(itemType).ToList();
 }
コード例 #6
0
 /// <summary>
 /// Gets the properties to display in LINQPad's Dump method. They should be the same as would appear in a DataGridView with AutoGenerateColumns.
 /// </summary>
 /// <returns>The properties to display in LINQPad's Dump</returns>
 private IEnumerable <PropertyDescriptor> GetPropertiesToDisplay()
 {
     return(MetaDataHelper.GetPropertiesToDisplay(GetType()));
 }
 public void EditPropertiesInDataGridViewTest()
 {
     TestShowInGrid(((IEntity)MetaSingletons.MetaData.AddressType.First()).CustomPropertiesOfType);
     TestShowInGrid(MetaDataHelper.GetPropertiesToDisplay(typeof(AddressTypeEntity)));
 }