Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Dapper
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
Dapper
Commits
603b2125
Commit
603b2125
authored
Jul 26, 2016
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests to complement documentation of pseudo-positional parameters
parent
e15cb95d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
Tests.cs
Dapper.Tests/Tests.cs
+32
-0
No files found.
Dapper.Tests/Tests.cs
View file @
603b2125
...
@@ -3315,6 +3315,38 @@ public void Issue569_SO38527197_PseudoPositionalParameters_In()
...
@@ -3315,6 +3315,38 @@ public void Issue569_SO38527197_PseudoPositionalParameters_In()
}
}
}
}
[
Fact
]
public
void
PseudoPositional_CanUseVariable
()
{
using
(
var
connection
=
ConnectViaOledb
())
{
int
id
=
42
;
var
row
=
connection
.
QuerySingle
(
"declare @id int = ?id?; select @id as [A], @id as [B];"
,
new
{
id
});
int
a
=
(
int
)
row
.
A
;
int
b
=
(
int
)
row
.
B
;
a
.
IsEqualTo
(
42
);
b
.
IsEqualTo
(
42
);
}
}
[
Fact
]
public
void
PseudoPositional_CannotUseParameterMultipleTimes
()
{
using
(
var
connection
=
ConnectViaOledb
())
{
try
{
int
id
=
42
;
var
row
=
connection
.
QuerySingle
(
"select ?id? as [A], ?id? as [B];"
,
new
{
id
});
Assert
.
Fail
();
}
catch
(
InvalidOperationException
ex
)
when
(
ex
.
Message
==
"When passing parameters by position, each parameter can only be referenced once"
)
{
// that's a win
}
}
}
[
Fact
]
[
Fact
]
public
void
PseudoPositionalParameters_ExecSingle
()
public
void
PseudoPositionalParameters_ExecSingle
()
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment