Exemple #1
0
        public void Should_check_and_throw_if_duplicated_column_found_on_a_row_with_object()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            ExcelWorksheet worksheet1 = excelPackage2.GetWorksheet("RandomOrderedColumns");

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            Action act1 = () => worksheet1.CheckAndThrowIfDuplicatedColumnsFound <UnorderedBarcodeAndQuantity>(1);
            Action act2 = () => worksheet1.CheckAndThrowIfDuplicatedColumnsFound <UnorderedBarcodeAndQuantity>(1, "'{0}' column is duplicated (rowIndex: {1})");

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            act1.Should().Throw <ExcelValidationException>().WithMessage("'Barcode' column is duplicated on 1. row.");
            act2.Should().Throw <ExcelValidationException>().WithMessage("'Barcode' column is duplicated (rowIndex: 1)");
        }