|
using System;
using NUnit.Framework;
using DbKeeperNet.Engine.Extensions.DatabaseServices;
using System.Data.Common;
namespace DbKeeperNet.Engine.Tests.Extensions.DatabaseServices
{
[TestFixture]
[Explicit]
[Category("pgsql")]
public class PgSqlDatabaseServiceTests : DatabaseServiceTests<PgSqlDatabaseService>
{
private const string APP_CONFIG_CONNECT_STRING = @"pgsql";
public PgSqlDatabaseServiceTests()
: base(APP_CONFIG_CONNECT_STRING)
{
}
[SetUp]
public void Startup()
{
CleanupDatabase();
}
[TearDown]
public void Shutdown()
{
CleanupDatabase();
}
private void CleanupDatabase()
{
using (IDatabaseService connectedService = CreateConnectedDbService())
{
ExecuteSqlAndIgnoreException(connectedService, "drop table pgsql_testing_table");
}
}
[Test]
[ExpectedException(typeof(NotSupportedException))]
public void TestProcedureNotExistsNullName()
{
TestStoredProcedureExists(null);
}
[Test]
public void TestExecuteSql()
{
using (IDatabaseService connectedService = CreateConnectedDbService())
{
connectedService.ExecuteSql("select 1");
}
}
[Test]
public void TestExecuteInvalidSqlStatement()
{
bool success = false;
using (IDatabaseService connectedService = CreateConnectedDbService())
{
try
{
connectedService.ExecuteSql("selectum magicum incorectum");
}
catch (DbException)
{
success = true;
}
}
Assert.That(success, Is.True);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I'm software developer since 1996. I started with assembler on Intel 8051 CPUs, during years I was interested in C, C++, Sybase PowerBuilder, PHP, Sybase Anywhere Database, MSSQL server and multiplatform development.
Currently I'm developing in C++ and C# (this is my favorit and I spent some time with MCPD achievement). I'm also interested in design patterns.