public void UpdateProvisioningTableInstance() { using (SqlConnection conn = _provisionningRuleManager.GetConnection()) using (SqlTransaction sqlTransac = conn.BeginTransaction()) { ProvisionTable pT = ProvisionTable.GetInstance(_user); try { _provisionningRuleManager.DeleteAllProvisioningRules(sqlTransac); int i = 1; foreach (ProvisioningRate pR in pT.ProvisioningRates) { pR.Number = i; _provisionningRuleManager.AddProvisioningRate(pR, sqlTransac); i++; } sqlTransac.Commit(); } catch (Exception ex) { sqlTransac.Rollback(); throw ex; } } }
public void TestDeleteProvisionningRules() { ProvisioningRuleManager provisioningRuleManager = (ProvisioningRuleManager)container["ProvisioningRuleManager"]; SqlTransaction transaction = provisioningRuleManager.GetConnection().BeginTransaction(); provisioningRuleManager.DeleteAllProvisioningRules(transaction); transaction.Commit(); List <ProvisioningRate> list = provisioningRuleManager.SelectAllProvisioningRates(); Assert.AreEqual(0, list.Count); }