[DataRow(2, "200%", "P0")]  // Differs between windows 10 (20%) & windows 7 (20 %)
        public void GetWriteData_CanConvertIntToDecimal_IntConverted(int inputData, string expectedData, string formatData)
        {
            // Arrange
            var attribute = new CsvConverterNumberAttribute()
            {
                StringFormat = formatData
            };
            var cut = new CsvConverterDecimalToInt();

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

            // Act
            string actualData = cut.GetWriteData(typeof(int), inputData, "Column1", 1, 1);

            // Windows 10 (2,000%) & Windows 7 (2,000 %) format percentages slightly differently
            // So remove spaces before comparing
            if (formatData != null && formatData.StartsWith("P"))
            {
                actualData = actualData.Replace(" ", "");
            }


            // Assert
            Assert.AreEqual(expectedData, actualData);
        }
        public void GetReadData_CannotHandleNonNumericStrings_ThrowsException(string inputData)
        {
            // Arrange
            var attribute = new CsvConverterNumberAttribute();
            var cut       = new CsvConverterDecimalToInt();

            cut.Initialize(attribute, 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_CanConvertNonNullableDecimalsWithoutAnAttribute_ValuesConverted(string inputData, int?expected)
        {
            // Arrange
            var attribute = new CsvConverterNumberAttribute();
            var cut       = new CsvConverterDecimalToInt();

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

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

            // Assert
            Assert.AreEqual(expected, actual);
        }
        [DataRow("58.88", 59, true, 2)] // decimal places are IGNORED during reading!
        public void GetReadData_CanRoundToGivenPrecision_NumberRoundedProperly(string inputData, int?expected,
                                                                               bool allowRounding, int numberOfDecimalPlaces)
        {
            // Arrange
            var attribute = new CsvConverterNumberAttribute()
            {
                AllowRounding = allowRounding, NumberOfDecimalPlaces = numberOfDecimalPlaces
            };
            var cut = new CsvConverterDecimalToInt();

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

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

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