Esempio n. 1
0
        private static PropertyInfo GetThePropertyOnThisObject(object @object, string propertyName)
        {
            var type = @object.GetType();

            return(type.GetProperties()
                   .FirstOrDefault(x => TEHelpers.IsPropertyMatchingToColumnName(x, propertyName)));
        }
 private static bool ThePropertyDoesNotExist <T>(T instance, TableRow row)
 {
     return(instance.GetType().GetProperties()
            .Any(property => TEHelpers.IsPropertyMatchingToColumnName(property, row.Id())) == false);
 }
        private void AssertThatAllColumnsInTheTableMatchToPropertiesOnTheType()
        {
            var propertiesThatDoNotExist = from columnHeader in table.Header
                                           where (typeof(T).GetProperties().Any(property => TEHelpers.IsPropertyMatchingToColumnName(property, columnHeader)) == false)
                                           select columnHeader;

            if (propertiesThatDoNotExist.Any())
            {
                throw new ComparisonException(
                          propertiesThatDoNotExist.Aggregate(@"The following fields do not exist:",
                                                             (running, next) => running + string.Format("{0}{1}", Environment.NewLine, next)));
            }
        }