test for multi command with a strong type

This commit is contained in:
Sam Saffron
2011-06-28 12:00:03 +10:00
parent 2706855a53
commit fcd385fd97
+19
View File
@@ -226,6 +226,25 @@ namespace SqlMapper
sum.IsEqualTo(10);
}
class Student
{
public string Name {get; set;}
public int Age { get; set; }
}
public void TestExecuteMultipleCommandStrongType()
{
connection.Execute("create table #t(Name nvarchar(max), Age int)");
int tally = connection.Execute(@"insert #t (Name,Age) values(@Name, @Age)", new List<Student>
{
new Student{Age = 1, Name = "sam"},
new Student{Age = 2, Name = "bob"}
});
int sum = connection.Query<int>("select sum(Age) from #t drop table #t").First();
tally.IsEqualTo(2);
sum.IsEqualTo(3);
}
public void TestExecuteMultipleCommandObjectArray()
{
connection.Execute("create table #t(i int)");