public void ConnectionStringBuilder_GetDatabaseFromDataSourceTest() { var builder = new ConnectionStringBuilder(); var connectionString = "Data Source =WarriorDB.db"; var database = builder.GetDatabase(connectionString); Assert.AreEqual(database, "WarriorDB.db"); connectionString = "Data Source=WarriorDB.db"; database = builder.GetDatabase(connectionString); Assert.AreEqual(database, "WarriorDB.db"); connectionString = "data source =WarriorDB.db"; database = builder.GetDatabase(connectionString); Assert.AreEqual(database, "WarriorDB.db"); connectionString = "data source=WarriorDB.db"; database = builder.GetDatabase(connectionString); Assert.AreEqual(database, "WarriorDB.db"); connectionString = "data source= WarriorDB.db"; database = builder.GetDatabase(connectionString); Assert.AreEqual(database, "WarriorDB.db"); connectionString = "data source=WarriorDB.db;"; database = builder.GetDatabase(connectionString); Assert.AreEqual(database, "WarriorDB.db"); connectionString = @"Data Source=c:\WarriorDB.db;Version=3;New=True;"; database = builder.GetDatabase(connectionString); Assert.AreEqual(database, @"c:\WarriorDB.db"); }
public void ConnectionStringBuilder_GetDatabaseFromDatabaseTest() { var builder = new ConnectionStringBuilder(); var connectionString = "data source=.;Database =WarriorDB;persist security info=False;user id=sa"; var database = builder.GetDatabase(connectionString); Assert.AreEqual(database, "WarriorDB"); connectionString = "data source=.;Database=WarriorDB;persist security info=False;user id=sa"; database = builder.GetDatabase(connectionString); Assert.AreEqual(database, "WarriorDB"); connectionString = "data source=.;database=WarriorDB;persist security info=False;user id=sa"; database = builder.GetDatabase(connectionString); Assert.AreEqual(database, "WarriorDB"); connectionString = "data source=.;database =WarriorDB;persist security info=False;user id=sa"; database = builder.GetDatabase(connectionString); Assert.AreEqual(database, "WarriorDB"); connectionString = "data source=.;database= WarriorDB;persist security info=False;user id=sa"; database = builder.GetDatabase(connectionString); Assert.AreEqual(database, "WarriorDB"); }