Пример #1
0
        public void ConvertFromStringTest()
        {
            var converter = new ByteConverter();

            Assert.Equal( (byte)123, converter.ConvertFromString( "123" ) );
            Assert.Equal( (byte)123, converter.ConvertFromString( " 123 " ) );

            Assert.Throws<NotSupportedException>( () => converter.ConvertFromString( null ) );
        }
Пример #2
0
        public void ConvertFromStringTest()
        {
            var converter = new ByteConverter();

            Assert.AreEqual( (byte)123, converter.ConvertFromString( CultureInfo.CurrentCulture, "123" ) );
            Assert.AreEqual( (byte)123, converter.ConvertFromString( CultureInfo.CurrentCulture, " 123 " ) );

            try
            {
                converter.ConvertFromString( CultureInfo.CurrentCulture, null );
                Assert.Fail();
            }
            catch( CsvTypeConverterException )
            {
            }
        }
Пример #3
0
        public void ConvertFromStringTest()
        {
            var converter = new ByteConverter();

            Assert.AreEqual( (byte)123, converter.ConvertFromString( "123" ) );
            Assert.AreEqual( (byte)123, converter.ConvertFromString( " 123 " ) );

            try
            {
                converter.ConvertFromString( null );
                Assert.Fail();
            }
            catch( NotSupportedException )
            {
            }
        }
Пример #4
0
        public void ConvertFromStringTest()
        {
            var converter = new ByteConverter();

            var propertyMapData = new CsvPropertyMapData( null );
            propertyMapData.TypeConverterOptions.CultureInfo = CultureInfo.CurrentCulture;

            Assert.AreEqual( (byte)123, converter.ConvertFromString( "123", null, propertyMapData ) );
            Assert.AreEqual( (byte)123, converter.ConvertFromString( " 123 ", null, propertyMapData ) );

            try
            {
                converter.ConvertFromString( null, null, propertyMapData );
                Assert.Fail();
            }
            catch( CsvTypeConverterException )
            {
            }
        }