forked from npgsql/npgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBenchmarkEnvironment.cs
More file actions
28 lines (24 loc) · 927 Bytes
/
BenchmarkEnvironment.cs
File metadata and controls
28 lines (24 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Npgsql.Benchmarks
{
static class BenchmarkEnvironment
{
internal static string ConnectionString => Environment.GetEnvironmentVariable("NPGSQL_TEST_DB") ?? DefaultConnectionString;
/// <summary>
/// Unless the NPGSQL_TEST_DB environment variable is defined, this is used as the connection string for the
/// test database.
/// </summary>
const string DefaultConnectionString = "Server=localhost;User ID=npgsql_tests;Password=npgsql_tests;Database=npgsql_tests";
internal static NpgsqlConnection GetConnection() => new NpgsqlConnection(ConnectionString);
internal static NpgsqlConnection OpenConnection()
{
var conn = GetConnection();
conn.Open();
return conn;
}
}
}