public void Should_check_columns_of_given_row_whether_it_contains_same_values_with_excel_exportable_object_properties() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- ExcelWorksheet worksheet1 = excelPackage2.GetWorksheet("RandomOrderedColumns"); ExcelWorksheet emptySheet1 = excelPackage1.GetWorksheet("EmptySheet"); ExcelWorksheet emptySheet2 = excelPackage1.GetWorksheet("EmptySheet"); //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- Action action1 = () => worksheet1.CheckExistenceOfColumnsAndThrow <NamedMap>(2, "'{0}' column is not found on the Excel."); Action action2 = () => worksheet1.CheckExistenceOfColumnsAndThrow <NamedMap>(2); Action action3 = () => worksheet1.CheckExistenceOfColumnsAndThrow <UnorderedBarcodeAndQuantity>(1); Action action4 = () => worksheet1.CheckExistenceOfColumnsAndThrow <Car>(2); Action actionForEmptySheet1 = () => emptySheet1.CheckExistenceOfColumnsAndThrow <StocksValidation>(1, "'{0}' column is not found on the worksheet."); Action actionForEmptySheet2 = () => emptySheet2.CheckExistenceOfColumnsAndThrow <Cars>(1, "'{0}' column is not found on the worksheet."); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- action1.Should().Throw <ExcelValidationException>().And.Message.Should().Be("'Name' column is not found on the Excel."); action2.Should().Throw <ExcelValidationException>().And.Message.Should().Be("'Name' column is not found on the worksheet."); action3.Should().NotThrow <ExcelValidationException>(); action4.Should().Throw <ArgumentException>(); actionForEmptySheet1.Should().Throw <ExcelValidationException>().And.Message.Should().Be("'Barcode' column is not found on the worksheet."); actionForEmptySheet2.Should().Throw <ExcelValidationException>().And.Message.Should().Be("'LicensePlate' column is not found on the worksheet."); }