Exemple #1
0
        public async Task <KeyValuePair <Type, IList> > MapType(TypeWithAttribute <ClassMappingAttribute> typeToMap)
        {
            Workbook workbook = await Workbook.CreateFromExcel(
                Path.GetFileNameWithoutExtension(typeToMap.Attribute.WorkbookPath),
                typeToMap.Attribute.WorkbookPath).ConfigureAwait(false);

            // Try to merge sheets inside this workbook.
            // If one balance workbook is splited into separated sheets that share the same structure.
            workbook.Merge();
            // If ClassMappingAttribute contains sheet name than try to get it from the workbook else take first.
            WorkbookSheet sheet = string.IsNullOrEmpty(typeToMap.Attribute.SheetName)
          ? workbook.Sheets[0] : workbook.GetSheetByName(typeToMap.Attribute.SheetName);

            if (sheet.Columns.Count == 0 || sheet.Rows.Count == 0)
            {
                throw new Exception($"Sheet '{sheet.Name}' in workbook '{workbook.WorkbookName}' is empty");
            }

            return(await MapType(typeToMap.Type, sheet, typeToMap.Attribute.Automapping).ConfigureAwait(false));
        }
 public void WhenStep_TestClassHasAttributes()
 {
     _typeWithAttribute = new TypeWithAttribute();
     _steps = new ExecutableAttributeStepScanner().Scan(TestContext.GetContext(_typeWithAttribute)).ToList();
 }
Exemple #3
0
 public void WhenStep_TestClassHasAttributes()
 {
     _typeWithAttribute = new TypeWithAttribute();
     _steps             = new ExecutableAttributeStepScanner().Scan(TestContext.GetContext(_typeWithAttribute)).ToList();
 }
Exemple #4
0
    public void should_ignore_graphqlmetadata_attribute()
    {
        var type = new TypeWithAttribute();

        type.Name.ShouldBe("TypeWithAttribute");
    }