カラオケ行く前に書けたのはこんなテストコードだけでしたorz
[TestFixture] public class ConnectionTest { private static DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.SqlClient"); private IDbConnection conn; [SetUp] public void SetUp() { conn = factory.CreateConnection(); conn.ConnectionString = Settings.Default.NORTHWNDConnectionString; conn.Open(); } [TearDown] public void TearDown() { conn.Close(); conn.Dispose(); conn = null; } [Test] public void IsConnected() { ConnectionState state = conn.State | ConnectionState.Open; Assert.AreEqual(ConnectionState.Open, state); } }
こんな風にコネクション作るとDBにあまり依存しないらしいが!!!
IDbConnectionにはGetSchemaが無いorz
SqlConnectionとか,DB固有の奴を使わないと駄目なんかぁ。
一気にやる気が失せた!!!