public void ConvertFromStringTest() { var converter = new CharConverter(); var propertyMapData = new MemberMapData(null); propertyMapData.TypeConverterOptions.CultureInfo = CultureInfo.CurrentCulture; var row = new CsvReader(new ParserMock()); Assert.Equal('a', converter.ConvertFromString("a", null, propertyMapData)); Assert.Equal('a', converter.ConvertFromString(" a ", null, propertyMapData)); Assert.Equal(' ', converter.ConvertFromString(" ", null, propertyMapData)); Assert.Throws <TypeConverterException>(() => converter.ConvertFromString(null, row, propertyMapData)); }
public void ConvertFromStringTest() { var converter = new CharConverter(); Assert.AreEqual('a', converter.ConvertFromString("a")); Assert.AreEqual('a', converter.ConvertFromString(" a ")); try { converter.ConvertFromString(null); Assert.Fail(); } catch (NotSupportedException) { } }
public void ConvertFromStringTest() { var converter = new CharConverter(); Assert.AreEqual('a', converter.ConvertFromString(CultureInfo.CurrentCulture, "a")); Assert.AreEqual('a', converter.ConvertFromString(CultureInfo.CurrentCulture, " a ")); try { converter.ConvertFromString(CultureInfo.CurrentCulture, null); Assert.Fail(); } catch (CsvTypeConverterException) { } }
public void ConvertFromStringTest() { var converter = new CharConverter(); var propertyMapData = new CsvPropertyMapData(null); propertyMapData.TypeConverterOptions.CultureInfo = CultureInfo.CurrentCulture; Assert.AreEqual('a', converter.ConvertFromString("a", null, propertyMapData)); Assert.AreEqual('a', converter.ConvertFromString(" a ", null, propertyMapData)); Assert.AreEqual(' ', converter.ConvertFromString(" ", null, propertyMapData)); try { converter.ConvertFromString(null, null, propertyMapData); Assert.Fail(); } catch (CsvTypeConverterException) { } }
public void ConvertFromStringTest() { var converter = new CharConverter(); var propertyMapData = new MemberMapData(null); propertyMapData.TypeConverterOptions.CultureInfo = CultureInfo.CurrentCulture; var mockRow = new Mock <IReaderRow>(); Assert.AreEqual('a', converter.ConvertFromString("a", null, propertyMapData)); Assert.AreEqual('a', converter.ConvertFromString(" a ", null, propertyMapData)); Assert.AreEqual(' ', converter.ConvertFromString(" ", null, propertyMapData)); try { converter.ConvertFromString(null, mockRow.Object, propertyMapData); Assert.Fail(); } catch (TypeConverterException) { } }