本文整理匯總了C#中Tests.DataClasses.SampleWebAppDb.GetKeyProperties方法的典型用法代碼示例。如果您正苦於以下問題:C# SampleWebAppDb.GetKeyProperties方法的具體用法?C# SampleWebAppDb.GetKeyProperties怎麽用?C# SampleWebAppDb.GetKeyProperties使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tests.DataClasses.SampleWebAppDb
的用法示例。
在下文中一共展示了SampleWebAppDb.GetKeyProperties方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Check02FindPostKeyAgainOk
public void Check02FindPostKeyAgainOk()
{
using (var db = new SampleWebAppDb())
{
//SETUP
var timer = new Stopwatch();
DataLayerInitialise.InitialiseThis();
var x = db.Posts.Count();
//ATTEMPT
timer.Start();
var keys = db.GetKeyProperties<Post>();
timer.Stop();
Console.WriteLine("took {0:f3} ms", 1000.0 * timer.ElapsedTicks / Stopwatch.Frequency);
//VERIFY
keys.Count.ShouldEqual(1);
keys.First().Name.ShouldEqual("PostId");
}
}
示例2: Check05FindPostTagGradeKeyOk
public void Check05FindPostTagGradeKeyOk()
{
using (var db = new SampleWebAppDb())
{
//SETUP
DataLayerInitialise.InitialiseThis();
//ATTEMPT
var keys = db.GetKeyProperties<PostTagGrade>();
//VERIFY
keys.Count.ShouldEqual(2);
keys.First().Name.ShouldEqual("PostId");
keys.Last().Name.ShouldEqual("TagId");
}
}
示例3: Check10FindDtoKeyBad
public void Check10FindDtoKeyBad()
{
using (var db = new SampleWebAppDb())
{
//SETUP
DataLayerInitialise.InitialiseThis();
//ATTEMPT
var ex = Assert.Throws<InvalidOperationException>( () => db.GetKeyProperties<SimplePostDto>());
//VERIFY
ex.Message.ShouldEqual("This method expects a entity class. Did you provide a DTO by mistake?");
}
}