Exemplo n.º 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 ) );
        }
Exemplo n.º 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 )
            {
            }
        }
Exemplo n.º 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 )
            {
            }
        }
Exemplo n.º 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 )
            {
            }
        }