Commit 5189fcd4 authored by David Glassborow's avatar David Glassborow Committed by Nick Craver

Tests for #1111 - Inconsistent deserialisation between normal Query<T> and SqlMapper.Parse<T>

parent 522d150e
...@@ -38,6 +38,16 @@ public void GetSameReaderForSameShape() ...@@ -38,6 +38,16 @@ public void GetSameReaderForSameShape()
Assert.False(ReferenceEquals(secondParser, thirdParser)); Assert.False(ReferenceEquals(secondParser, thirdParser));
} }
[Fact]
public void TestTreatIntAsABool()
{
// Test we are consistent with direct call to database, see TypeHandlerTests.TestTreatIntAsABool
using(var reader = connection.ExecuteReader("select CAST(1 AS BIT)"))
Assert.True(SqlMapper.Parse<bool>(reader).Single());
using (var reader = connection.ExecuteReader("select 1"))
Assert.True(SqlMapper.Parse<bool>(reader).Single());
}
[Fact] [Fact]
public void DiscriminatedUnion() public void DiscriminatedUnion()
{ {
......
...@@ -592,6 +592,13 @@ public void TestWrongTypes_WithWrongTypes() ...@@ -592,6 +592,13 @@ public void TestWrongTypes_WithWrongTypes()
Assert.True(item.D); Assert.True(item.D);
} }
[Fact]
public void TestTreatIntAsABool()
{
Assert.True(connection.Query<bool>("select CAST(1 AS BIT)").Single());
Assert.True(connection.Query<bool>("select 1").Single());
}
[Fact] [Fact]
public void SO24607639_NullableBools() public void SO24607639_NullableBools()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment