public SpecificationSpecificClassGeneratorBase(
     ExcelCsharpPropertyMatcher excelCsharpPropertyMatcher,
     GivenClass excelGivenClass)
 {
     this.excelCsharpPropertyMatcher = excelCsharpPropertyMatcher ?? throw new ArgumentNullException(nameof(excelCsharpPropertyMatcher));
     this.excelGivenClass            = excelGivenClass ?? throw new ArgumentNullException(nameof(excelGivenClass));
 }
        float PercentMatchingProperties(Type interfaceType, GivenClass excelClass)
        {
            if (excelClass.Properties.Any())
            {
                // this gets things in ancestor interfaces as well as directly on the interface
                var properties =
                    (new Type[] { interfaceType })
                    .Concat(interfaceType.GetInterfaces())
                    .SelectMany(i => i.GetProperties());

                var methods =
                    (new Type[] { interfaceType })
                    .Concat(interfaceType.GetInterfaces())
                    .SelectMany(i => i.GetMethods());

                return
                    ((float)excelClass.Properties.Count(
                         excelProperty =>
                         MatchesAnyCsharpPropertyOrFunction(
                             excelProperty,
                             properties,
                             methods)
                         )
                     / (float)excelClass.Properties.Count());
            }
            else
            {
                return(1);
            }
        }
 public ClassMatch Matches(Type type, GivenClass simpleExcelClass)
 {
     return(new ClassMatch(
                MatchesAtAll(type, simpleExcelClass),
                PercentMatchingProperties(type, simpleExcelClass)
                ));
 }
 public SpecificationSpecificRootClassGenerator(ExcelCsharpPropertyMatcher excelCsharpPropertyMatcher, GivenClass excelGivenClass)
     : base(excelCsharpPropertyMatcher, excelGivenClass)
 {
 }
 static bool MatchesAtAll(Type type, GivenClass simpleExcelClass)
 {
     return
         (type.IsInterface &&
          ClassNameMatcher.NamesMatch(type.Name, simpleExcelClass.Name));
 }