public void ShouldExportExcelFileWithDefaultTableStyle() { var stream = new ExportManagerBuilder <ModelTableWithOutTableStyle>() .Init() .SetData(VariablesModelTableWithOutTableStyle.Data.ToList()) .StartExportProcess(); StreamTestFile.SaveExternalFile(stream); }
public void ShouldImportDateTimeFieldFromDateColumn() { var result = new ImportManagerBuilder <ModelDateTimeProperty>() .OpenFile(StreamTestFile.GetStreamTestFile(), VariablesModelDateTimeProperty.WorksheetName) .Init() .StartImportProcess(); result.Should().NotBeNullOrEmpty(); result.Count.Should().Be(2); result[0].BirthDay.Should().BeSameDateAs(new DateTime(1991, 08, 28)); result[1].BirthDay.Should().BeSameDateAs(new DateTime(2021, 1, 1)); StreamTestFile.CloseFile(); }
public void ShouldImportIntFieldFromBooleanColumn() { var result = new ImportManagerBuilder <ModelBoolNullableProperty>() .OpenFile(StreamTestFile.GetStreamTestFile(), VariablesModelBoolNullableProperty.WorksheetName) .Init() .StartImportProcess(); result.Should().NotBeNullOrEmpty(); result.Count.Should().Be(2); result[0].Active.Should().BeTrue(); result[1].Active.Should().BeNull(); StreamTestFile.CloseFile(); }
public void ShouldImportDecimalFieldFromNumberColumn() { var result = new ImportManagerBuilder <ModelDecimalNullableProperty>() .OpenFile(StreamTestFile.GetStreamTestFile(), VariablesModelDecimalNullableProperty.WorksheetName) .Init() .StartImportProcess(); result.Should().NotBeNullOrEmpty(); result.Count.Should().Be(2); result[0].Salary.Should().Be((decimal)12233.45); result[1].Salary.Should().BeNull(); StreamTestFile.CloseFile(); }
public void ShouldImportIntFieldFromNumberColumn() { var result = new ImportManagerBuilder <ModelStringProperty>() .OpenFile(StreamTestFile.GetStreamTestFile(), VariablesModelStringProperty.WorksheetName) .Init() .StartImportProcess(); result.Should().NotBeNullOrEmpty(); result.Count.Should().Be(2); result[0].Name.Should().Be("Ruan"); result[1].Name.Should().Be(""); StreamTestFile.CloseFile(); }
public void ShouldExportExcelFileWithBooleanColumn() { var stream = new ExportManagerBuilder <ModelBoolNullableProperty>() .Init() .SetData(VariablesModelBoolNullableProperty.Data.ToList()) .StartExportProcess(); var workbook = new XLWorkbook(stream); workbook.TryGetWorksheet(VariablesModelBoolNullableProperty.WorksheetName, out var worksheet); StreamTestFile.SaveExternalFile(stream); worksheet.Should().NotBeNull(); worksheet.Cell(1, 5).Value.ToString().Should() .BeEquivalentTo(VariablesModelBoolNullableProperty.FieldName); worksheet.Cell(2, 5).Value.Should() .BeEquivalentTo(VariablesModelBoolNullableProperty.Data[0].Active); worksheet.Cell(3, 5).Value.Should() .BeEquivalentTo(VariablesModelBoolNullableProperty.Data[1].Active); worksheet.Cell(4, 5).Value.Should().Be(""); }