public void GetReadData_CannotHandleNonNumericStrings_ThrowsException(string inputData)
        {
            // Arrange
            var cut = new CsvConverterDefaultDecimal();

            cut.Initialize(null, new DefaultTypeConverterFactory());

            // Act
            decimal actual = (decimal)cut.GetReadData(typeof(decimal), inputData, "Column1", 1, 1);

            // Assert
            Assert.Fail("Exception should be thrown when invalid values are passed into the parser!");
        }
        public void GetReadData_CanConvertNullableDecimalsWithoutAnAttribute_ValuesConverted(string inputData, string expectedAsString)
        {
            // Arrange
            decimal?expected = string.IsNullOrWhiteSpace(expectedAsString) ? (decimal?)null : decimal.Parse(expectedAsString);
            var     cut      = new CsvConverterDefaultDecimal();

            cut.Initialize(null, new DefaultTypeConverterFactory());

            // Act
            decimal?actual = (decimal?)cut.GetReadData(typeof(decimal?), inputData, "Column1", 1, 1);

            // Assert
            Assert.AreEqual(expected, actual);
        }
        public void GetReadData_CanRoundToGivenPrecision_NumberRoundedProperly(string inputData, string expectedAsString,
                                                                               bool allowRounding, int numberOfDecimalPlaces)
        {
            // Arrange
            decimal expected = decimal.Parse(expectedAsString);
            var     cut      = new CsvConverterDefaultDecimal();

            cut.AllowRounding = allowRounding;
            cut.Initialize(null, new DefaultTypeConverterFactory());
            cut.NumberOfDecimalPlaces = numberOfDecimalPlaces;

            // Act
            decimal actual = (decimal)cut.GetReadData(typeof(decimal), inputData, "Column1", 1, 1);

            // Assert
            Assert.AreEqual(expected, actual);
        }