Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 5cda1be

Browse files
committed
Add new mismatch schema test
1 parent a22138d commit 5cda1be

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/ServiceStack.OrmLite.Tests/Issues/MismatchSchemaTests.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ public class ModelIntValue
1010
public int Id { get; set; }
1111
public int? Value { get; set; }
1212
public string Text { get; set; }
13+
public long LongMismatch { get; set; }
14+
public int? LongMismatch2 { get; set; }
1315
}
1416
}
1517

@@ -20,6 +22,8 @@ public class ModelIntValue
2022
public int Id { get; set; }
2123
public int Value { get; set; }
2224
public string Text { get; set; }
25+
public int? LongMismatch { get; set; }
26+
public long LongMismatch2 { get; set; }
2327
}
2428
}
2529

@@ -42,5 +46,21 @@ public void Does_allow_reading_from_table_with_mismatched_nullable_int_type()
4246
Assert.That(row.Text, Is.EqualTo("Foo"));
4347
}
4448
}
49+
50+
[Test]
51+
public void Does_allow_reading_from_table_with_mismatched_number_types()
52+
{
53+
using (var db = OpenDbConnection())
54+
{
55+
db.DropAndCreateTable<Nullable.ModelIntValue>();
56+
57+
db.Insert(new Nullable.ModelIntValue { Id = 1, LongMismatch = 1, LongMismatch2 = 2 });
58+
59+
var row = db.SingleById<NotNullable.ModelIntValue>(1);
60+
61+
Assert.That(row.LongMismatch, Is.EqualTo(1));
62+
Assert.That(row.LongMismatch2, Is.EqualTo(2));
63+
}
64+
}
4565
}
4666
}

0 commit comments

Comments
 (0)