public DataAccessTestBase()
        {
            var databaseFile = @"C:\Users\Nho\Documents\Visual Studio 2012\Projects\DBHelper\DBHelper\db\EnghlistHelperDB.sdf_" + System.Guid.NewGuid().ToString().Replace("{", string.Empty).Replace("}", string.Empty) + ".sdf";

            EntityBase.ConnectionString = "Data Source='" + databaseFile + "'";
            if (System.IO.File.Exists(databaseFile))
            {
                return;
            }
            try { DatabaseFile.CreateDatabase(); } catch {}
        }
Ejemplo n.º 2
0
        public void CreateDatabaseTest()
        {
            var databaseFile = @"C:\Users\Nho\Documents\Visual Studio 2012\Projects\DBHelper\DBHelper\db\EnghlistHelperDB.sdf_" + System.Guid.NewGuid().ToString().Replace("{", string.Empty).Replace("}", string.Empty) + ".sdf";

            EntityBase.ConnectionString = "Data Source='" + databaseFile + "'";
            EntityBase.Connection.Dispose();
            EntityBase.Connection = null;

            var actual = DatabaseFile.CreateDatabase();

            Assert.AreNotEqual(0, actual);

            EntityBase.ConnectionString = @"Data Source=C:\Users\Nho\Documents\Visual Studio 2012\Projects\DBHelper\DBHelper\db\EnghlistHelperDB.sdf; Password=123456a@";
            EntityBase.Connection.Dispose();
            EntityBase.Connection = null;
        }