示例#1
0
        public void GetReadData_CannotHandleNonNumericStrings_ThrowsException(string inputData)
        {
            // Arrange
            var cut = new CsvConverterDefaultShort();

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

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

            // Assert
            Assert.Fail("Exception should be thrown when invalid values are passed into the parser!");
        }
示例#2
0
        public void GetReadData_CanConvertNullableShortsWithoutAnAttribute_ValuesConverted(string inputData, short?expected)
        {
            // Arrange
            var cut = new CsvConverterDefaultShort();

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

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

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