Exemple #1
0
        private static void ClearDatabase()
        {
            SqlConnectionStringBuilder b = new SqlConnectionStringBuilder();
            b.DataSource = "localhost";
            b.InitialCatalog = "TestingNbuLib";
            b.IntegratedSecurity = true;

            using (SqlConnection conn = new SqlConnection(b.ConnectionString))
            {
                conn.Open();
                DatabaseManager mgr = new DatabaseManager(conn);
                mgr.LoadSchema();
                while (mgr.Tables.Count > 0)
                    mgr.DropTable(mgr.Tables[0], true);

                mgr.LoadSchema();
                Assert.AreEqual(0, mgr.Tables.Count);
            }
        }
        private static void ClearDatabase()
        {
            using (SqlConnection conn = getConnection())
            {
                conn.Open();
                DatabaseManager mgr = new DatabaseManager(conn);
                mgr.LoadSchema();
                while (mgr.Tables.Count > 0)
                    mgr.DropTable(mgr.Tables[0], true);

                mgr.LoadSchema();
                Assert.AreEqual(0, mgr.Tables.Count);
            }
        }
Exemple #3
0
        public void Prepare()
        {
            SqlConnectionStringBuilder b = new SqlConnectionStringBuilder();
            b.DataSource = "localhost";
            b.InitialCatalog = "TestingNbuLib";
            b.IntegratedSecurity = true;

            using (SqlConnection conn = new SqlConnection(b.ConnectionString))
            {
                conn.Open();
                DatabaseManager mgr = new DatabaseManager(conn);
                mgr.LoadSchema();
                while (mgr.Tables.Count > 0)
                    mgr.DropTable(mgr.Tables[0], true);

                mgr.LoadSchema();
                Assert.AreEqual(0, mgr.Tables.Count);
            }

            svc = new DomainModelService(new TestDatabaseService(), new IDomainChangeListener[] { new EntityRepositoryDomainListener() });
            svc.Save(new DomainModel());
        }