view HowTo/Data/OpenConfig3.cs @ 8:a34cfdde80d6

removed strong signing added FrameworkPathOverride for linux builds
author cin
date Wed, 29 Nov 2017 12:43:52 +0300
parents f990fcb411a9
children
line wrap: on
line source

using System;
using System.Data;
using System.Data.SqlClient;

using NUnit.Framework;

using BLToolkit.Data;
using BLToolkit.Data.DataProvider;

namespace HowTo.Data
{
	[TestFixture]
	public class OpenConfig3
	{
		const string connectionString =
			"Server=.;Database=BLToolkitData;Integrated Security=SSPI";

		[Test]
		public void DbConnectionConfiguration()
		{
			using (SqlConnection con = new SqlConnection(connectionString))
			{
				con.Open();

				using (DbManager db = /*[a]*/new DbManager(con)/*[/a]*/)
				{
					Assert.AreEqual(ConnectionState.Open, db.Connection.State);
				}
			}
		}

		[Test]
		public void DbTransactionConfiguration()
		{
			using (SqlConnection con = new SqlConnection(connectionString))
			{
				con.Open();

				SqlTransaction tran = con.BeginTransaction();

				using (DbManager db = /*[a]*/new DbManager(tran)/*[/a]*/)
				{
					Assert.AreEqual(ConnectionState.Open, db.Connection.State);
				}

				tran.Commit();
			}
		}

		[Test]
		public void DataProviderConfiguration()
		{
			SqlDataProvider dp = new SqlDataProvider();

			using (DbManager db = /*[a]*/new DbManager(dp, connectionString)/*[/a]*/)
			{
				Assert.AreEqual(ConnectionState.Open, db.Connection.State);
			}
		}
	}
}