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

Commit a7fb238

Browse files
committed
Add example of SingleById
1 parent 259673b commit a7fb238

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

tests/ServiceStack.OrmLite.Tests/ApiSqlServerTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using NUnit.Framework;
55
using ServiceStack.OrmLite.Tests.Shared;
6+
using ServiceStack.Text;
67

78
namespace ServiceStack.OrmLite.Tests
89
{
@@ -118,6 +119,9 @@ public void API_SqlServer_Examples()
118119
db.WhereLazy<Person>(new { Age = 27 }).ToList();
119120
Assert.That(db.GetLastSql(), Is.EqualTo("SELECT \"Id\", \"FirstName\", \"LastName\", \"Age\" FROM \"Person\" WHERE \"Age\" = @Age"));
120121

122+
db.SingleById<Person>(1);
123+
Assert.That(db.GetLastSql(), Is.EqualTo("SELECT \"Id\", \"FirstName\", \"LastName\", \"Age\" FROM \"Person\" WHERE \"Id\" = @Id"));
124+
121125
db.Single<Person>(new { Age = 42 });
122126
Assert.That(db.GetLastSql(), Is.EqualTo("SELECT \"Id\", \"FirstName\", \"LastName\", \"Age\" FROM \"Person\" WHERE \"Age\" = @Age"));
123127

tests/ServiceStack.OrmLite.Tests/ApiSqliteTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ public void API_Sqlite_Examples()
119119
db.WhereLazy<Person>(new { Age = 27 }).ToList();
120120
Assert.That(db.GetLastSql(), Is.EqualTo("SELECT \"Id\", \"FirstName\", \"LastName\", \"Age\" FROM \"Person\" WHERE \"Age\" = @Age"));
121121

122+
db.SingleById<Person>(1);
123+
Assert.That(db.GetLastSql(), Is.EqualTo("SELECT \"Id\", \"FirstName\", \"LastName\", \"Age\" FROM \"Person\" WHERE \"Id\" = @Id"));
124+
122125
db.Single<Person>(new { Age = 42 });
123126
Assert.That(db.GetLastSql(), Is.EqualTo("SELECT \"Id\", \"FirstName\", \"LastName\", \"Age\" FROM \"Person\" WHERE \"Age\" = @Age"));
124127

0 commit comments

Comments
 (0)