Skip to content
This repository
Browse code

Merge pull request #87 from elaforc/bugfix-booleanconverter

Fixed issue #58 - boolean converter returning true for no
  • Loading branch information...
commit 931c02d14c81f5f2489cce280b2e640e44ff2c80 2 parents 47313ad + b810152
Josh Close authored December 08, 2012
12  src/CsvHelper.Tests/TypeConversion/BooleanConverterTests.cs
@@ -40,14 +40,14 @@ public void ConvertFromStringTest()
40 40
 			Assert.False( (bool)converter.ConvertFromString( "False" ) );
41 41
 			Assert.False( (bool)converter.ConvertFromString( "FALSE" ) );
42 42
 			Assert.False( (bool)converter.ConvertFromString( "0" ) );
43  
-			Assert.True( (bool)converter.ConvertFromString( "no" ) );
44  
-			Assert.True( (bool)converter.ConvertFromString( "NO" ) );
45  
-			Assert.True( (bool)converter.ConvertFromString( "n" ) );
46  
-			Assert.True( (bool)converter.ConvertFromString( "N" ) );
  43
+			Assert.False( (bool)converter.ConvertFromString( "no" ) );
  44
+			Assert.False( (bool)converter.ConvertFromString( "NO" ) );
  45
+			Assert.False( (bool)converter.ConvertFromString( "n" ) );
  46
+			Assert.False( (bool)converter.ConvertFromString( "N" ) );
47 47
 			Assert.False( (bool)converter.ConvertFromString( " false " ) );
48 48
 			Assert.False( (bool)converter.ConvertFromString( " 0 " ) );
49  
-			Assert.True( (bool)converter.ConvertFromString( " no " ) );
50  
-			Assert.True( (bool)converter.ConvertFromString( " n " ) );
  49
+			Assert.False( (bool)converter.ConvertFromString( " no " ) );
  50
+			Assert.False( (bool)converter.ConvertFromString( " n " ) );
51 51
 
52 52
 			Assert.Throws<NotSupportedException>( () => converter.ConvertFromString( null ) );
53 53
 		}
2  src/CsvHelper/TypeConversion/BooleanConverter.cs
@@ -44,7 +44,7 @@ public override object ConvertFromString( CultureInfo culture, string text )
44 44
 			if( culture.CompareInfo.Compare( "no", t, CompareOptions.IgnoreCase ) == 0 ||
45 45
 				culture.CompareInfo.Compare( "n", t, CompareOptions.IgnoreCase ) == 0 )
46 46
 			{
47  
-				return true;
  47
+				return false;
48 48
 			}
49 49
 
50 50
 			return base.ConvertFromString( culture, text );

0 notes on commit 931c02d

Please sign in to comment.
Something went wrong with that request. Please try again.