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
b466cd6a
Commit
b466cd6a
authored
Feb 11, 2016
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Postgresql tests skip cleanly rather than error if no server
parent
a4bb66de
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
5 deletions
+32
-5
Tests.cs
Dapper.Tests/Tests.cs
+28
-3
project.json
Dapper.Tests/project.json
+4
-2
No files found.
Dapper.Tests/Tests.cs
View file @
b466cd6a
...
...
@@ -3218,12 +3218,11 @@ class Cat
new
Cat
()
{
Breed
=
"Persian"
,
Name
=
"MAGNA"
}
};
[
Fact
]
[
Fact
PostgresqlAttribute
]
public
void
TestPostgresqlArrayParameters
()
{
using
(
var
conn
=
new
NpgsqlConnection
(
"Server=localhost;Port=5432;User Id=dappertest;Password=dapperpass;Database=dappertest"
))
// ;Encoding=UNICODE
using
(
var
conn
=
OpenPostgresqlConnection
())
{
conn
.
Open
();
IDbTransaction
transaction
=
conn
.
BeginTransaction
();
conn
.
Execute
(
"create table tcat ( id serial not null, breed character varying(20) not null, name character varying (20) not null);"
);
conn
.
Execute
(
"insert into tcat(breed, name) values(:breed, :name) "
,
Cats
);
...
...
@@ -3236,6 +3235,32 @@ public void TestPostgresqlArrayParameters()
transaction
.
Rollback
();
}
}
static
NpgsqlConnection
OpenPostgresqlConnection
()
{
var
conn
=
new
NpgsqlConnection
(
"Server=localhost;Port=5432;User Id=dappertest;Password=dapperpass;Database=dappertest"
);
// ;Encoding=UNICODE
conn
.
Open
();
return
conn
;
}
public
class
FactPostgresqlAttribute
:
FactAttribute
{
public
override
string
Skip
{
get
{
return
unavailable
??
base
.
Skip
;
}
set
{
base
.
Skip
=
value
;
}
}
private
static
string
unavailable
;
static
FactPostgresqlAttribute
()
{
try
{
using
(
OpenPostgresqlConnection
())
{
}
}
catch
(
Exception
ex
)
{
unavailable
=
$"Postgresql is unavailable:
{
ex
.
Message
}
"
;
}
}
}
#endif
}
}
Dapper.Tests/project.json
View file @
b466cd6a
...
...
@@ -78,7 +78,8 @@
"MASSIVE"
,
"ORMLITE"
,
"SOMA"
,
"SIMPLEDATA"
"SIMPLEDATA"
,
"XUNIT2"
]
},
"frameworkAssemblies"
:
{
...
...
@@ -139,7 +140,8 @@
"MASSIVE"
,
"ORMLITE"
,
"SOMA"
,
"SIMPLEDATA"
"SIMPLEDATA"
,
"XUNIT2"
]
},
"frameworkAssemblies"
:
{
...
...
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