本文整理汇总了C#中SQLite.Net.Tests.TestDb.ExecuteScalar方法的典型用法代码示例。如果您正苦于以下问题:C# TestDb.ExecuteScalar方法的具体用法?C# TestDb.ExecuteScalar怎么用?C# TestDb.ExecuteScalar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite.Net.Tests.TestDb
的用法示例。
在下文中一共展示了TestDb.ExecuteScalar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckMaxLengthAttributesSubtypesRespected
public void CheckMaxLengthAttributesSubtypesRespected()
{
var db = new TestDb();
db.CreateTable<Tweet>();
string creationString = db.ExecuteScalar<string>("select min(sql) from sqlite_master");
Assert.That(creationString, Is.StringContaining("varchar(140)"));
}
示例2: NullableSumTest
public void NullableSumTest()
{
SQLiteConnection db = new TestDb();
db.CreateTable<NullableIntClass>();
var r = db.ExecuteScalar<int>("SELECT SUM(NullableInt) FROM NullableIntClass WHERE 1 = 0");
Assert.AreEqual(0, r);
}
示例3: CanUseSubtypeOfTableAttribute
public void CanUseSubtypeOfTableAttribute()
{
var db = new TestDb();
db.CreateTable<Cat>();
db.Insert(new Cat()
{
Breed = "Siamese"
});
int numCats = db.ExecuteScalar<int>("select count(*) from Cats");
Assert.That(numCats,Is.EqualTo(1), "The resulting num cats should be 1.");
}