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

            return(type.GetProperties()
                   .FirstOrDefault(x => TEHelpers.IsMemberMatchingToColumnName(x, propertyName)));
        }
 private static bool ThePropertyDoesNotExist <T>(T instance, TableRow row)
 {
     return(instance.GetType().GetProperties()
            .Any(property => TEHelpers.IsMemberMatchingToColumnName(property, row.Id())) == false);
 }
Exemplo n.º 3
0
        private void AssertThatAllColumnsInTheTableMatchToPropertiesOnTheType()
        {
            var propertiesThatDoNotExist = from columnHeader in table.Header
                                           where (typeof(T).GetProperties().Any(property => TEHelpers.IsMemberMatchingToColumnName(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)));
            }
        }