示例#1
0
文件: DbSetup.cs 项目: cbright/beacon
        public static void BeforeTestRun()
        {
            SqlDbUnitTest = new SqlDbUnitTest(ConfigurationManager.ConnectionStrings["tanktemp"].ConnectionString);
            SqlDbUnitTest.ReadXmlSchema(@"schema.xsd");

            SqlDbUnitTest.ReadXml(@"testdata.xml");
            SqlDbUnitTest.PerformDbOperation(DbOperationFlag.CleanInsertIdentity);
        }
        public static void FixtureSetup(TestContext context)
        {
            database = new SqlDbUnitTest(ConfigurationManager.ConnectionStrings["DB"].ConnectionString);
            database.ReadXmlSchema(@"EmployeeADODatabase.xsd");
            database.ReadXml(@"EmployeeADOTestData.xml");

            database.PerformDbOperation(DbOperationFlag.DeleteAll);
        }
示例#3
0
 internal SqlDbUnitTest SetUpDatabase(string connectionString, Stream xsdStream, Stream dataStream, DbOperationFlag operation)
 {
     Assert.IsNotNull(xsdStream);
     Assert.IsNotNull(dataStream);
     SqlDbUnitTest dbUnitTest = new SqlDbUnitTest(connectionString);
     dbUnitTest.ReadXmlSchema(xsdStream);
     dbUnitTest.ReadXml(dataStream);
     dbUnitTest.PerformDbOperation(operation);
     return dbUnitTest;
 }
示例#4
0
        public void CreateFixtureNow()
        {
            SqlDbUnitTest dbUnit = new SqlDbUnitTest(connectionString);

            dbUnit.ReadXmlSchema(@"DBFixtures/JewelryItems.xsd");

            DataSet ds = dbUnit.GetDataSetFromDb();

            ds.WriteXml(@"DBFixtures/JewelryItemsAllCategories.xml");
        }
示例#5
0
        public void Initialize()
        {
            // string connectionString = "server=localhost;user=dbuser;password=dbpassword;initial catalog=MyDatabase;";
            NDbUnit.Core.INDbUnitTest mySqlDatabase = new NDbUnit.Core.SqlClient.SqlDbUnitTest(connectionString);

            mySqlDatabase.ReadXmlSchema(@"DBFixtures/JewelryItems.xsd");
            mySqlDatabase.ReadXml(@"DBFixtures/JewelryItemsAllCategories.xml");

            mySqlDatabase.PerformDbOperation(NDbUnit.Core.DbOperationFlag.CleanInsertIdentity);

            settingManager = MockRepository.GenerateStub <ISettingManager>();
        }
示例#6
0
        protected INDbUnitTest SetUpDatabase(DbOperationFlag operation, Stream datasetStream = null)
        {
            Assert.IsNotNull(DatabaseSchema);

            SetUpNhibernateSession();

            INDbUnitTest dbUnitTest = new SqlDbUnitTest(this.ConnectionString);
            dbUnitTest.ReadXmlSchema(this.DatabaseSchema);
            if(datasetStream != null) dbUnitTest.ReadXml(datasetStream);

            dbUnitTest.PerformDbOperation(operation);

            return dbUnitTest;
        }
        public void Initialize()
        {
            // string connectionString = "server=localhost;user=dbuser;password=dbpassword;initial catalog=MyDatabase;";
            NDbUnit.Core.INDbUnitTest mySqlDatabase = new NDbUnit.Core.SqlClient.SqlDbUnitTest(connectionString);

            mySqlDatabase.ReadXmlSchema(@"DBFixtures/JewelryItems.xsd");
            mySqlDatabase.ReadXml(@"DBFixtures/JewelryItemsAllCategories.xml");

            mySqlDatabase.PerformDbOperation(NDbUnit.Core.DbOperationFlag.CleanInsertIdentity);

            settingManager = MockRepository.GenerateStub<ISettingManager>();
        }
示例#8
0
 private static void WipeOutDatabase()
 {
     SqlDbUnitTest testDb = new SqlDbUnitTest(@"Data Source=ISPG341\SQLEXPRESS;Initial Catalog=Daphne;Integrated Security=True");
     testDb.ReadXmlSchema(@"..\..\database.xsd");
     testDb.PerformDbOperation(DbOperationFlag.DeleteAll);
 }
示例#9
0
 protected static INDbUnitTest CreateDataController(string connectionStringKey)
 {
     var result = new SqlDbUnitTest(ConfigurationManager.ConnectionStrings[connectionStringKey].ConnectionString);
     using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Bits.IntegrationTests.Database.xsd"))
     {
         result.ReadXmlSchema(stream);
     }
     return result;
 }
示例#10
0
 private static INDbUnitTest ObterBaseDeDados()
 {
     var baseDeDados = new SqlDbUnitTest(ConfiguracaoDeTestes.StringDeConexao);
     return baseDeDados;
 }
 public DatabaseCleaner ConnectTo(string connectionString)
 {
     _connection = new SqlDbUnitTest(connectionString);
     return this;
 }
示例#12
0
        public void GetMyTestDataXmlFile()
        {
            var connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["IntegrationTests.Properties.Settings.TDDWithMVCConnectionString"].ConnectionString;

            var mySqlDatabase = new SqlDbUnitTest(connectionString);

            mySqlDatabase.ReadXmlSchema(DatabaseXsd02);

            System.Data.DataSet ds = mySqlDatabase.GetDataSetFromDb();
            ds.WriteXml(TestdataXml02);
        }