I have a code that goes something like this:
using (TransactionScope scope =
new TransactionScope(TransactionScopeOption.Required), new TransactionOptions)
{
IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted }))
// "dirty" read for test purposes , to see if my
// select will actually select the information I just inserted
actual = target.GetCostCentersRates(accountId);
}
this does not work, i have tested the queries and they work effectively when data is commited, but when it is not committed it presents the problem of not allowing me the dirty read to check , even when the isolation level is set to readuncommitted.
I would like to just figure out why i cant access the information, for I cannot by any means commit the information to our database, since this is a test method.
thank you!
Here is the whole thing
public void GetCostCentersRatesTest()
{
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommited }))
{
//Arrange
BRL.AdministrativeArea.SystemClientBusinessRole systemClient = new BRL.AdministrativeArea.SystemClientBusinessRole();
int systemClientId = systemClient.InsertSystemClient(systemClientInfo).systemClientId;
BRL.BRLProperties.systemClientId = systemClientId;
employeeInfo.multiCompaniesInfo.systemClientId = systemClientId;
int stateId = 1;
int cityId = 1;
int functionId = 1;
employeeInfo.stateId = stateId;
employeeInfo.cityId = cityId;
employeeInfo.functionId = functionId;
int employeeId = employees.InsertEmployeers(employeeInfo);
BRL.BRLProperties.employeeId = employeeId;
IActionReturnInfo actionAccount = (accounts.InsertAccountPlan(accountPlanInfo));
int accountId = Convert.ToInt32(actionAccount.UpdateDataSourceList[0].ToString());
clientInfo.stateId = stateId;
clientInfo.cityId = cityId;
clientInfo.stateIdCorrespondency = stateId;
clientInfo.cityIdCorrespondency = cityId;
clientInfo.stateIdDelivery = stateId;
clientInfo.cityIdDelivery = cityId;
clientInfo.multiCompaniesInfo.systemClientId = systemClientId;
clientInfo.multiCompaniesInfo.employeeId = employeeId;
int clientId;
clients.InsertClient(clientInfo, out clientId);
centerCostInfo.systemClientId = systemClientId;
centerCostInfo.clientId = clientId;
centerCostInfo.employeeId = employeeId;
centerCostInfo.directorID = employeeId;
centerCostInfo.managerID = employeeId;
centerCostInfo.multiCompaniesInfo.systemClientId = systemClientId;
centerCostInfo.multiCompaniesInfo.employeeId = employeeId;
IActionReturnInfo action = new CenterCostsBusinessRole().InsertCostCenter(centerCostInfo);
int centerCostId = Convert.ToInt32(action.UpdateDataSourceList[0].ToString());
rate.accountId = accountId;
rate.centerCostId = centerCostId;
costCenterRates.Add(rate);
int costCenterRateId;
AccountBusinessRole target = new AccountBusinessRole();
DataSet actual;
IActionReturnInfo costCenterRateAction = accounts.InsertCenterCostRates(costCenterRates);
costCenterRateId = Convert.ToInt32(costCenterRateAction.UpdateDataSourceList[0].ToString());
//Act
actual = target.GetCostCentersRates(accountId);
//Assert
Assert.IsTrue(FindInDataset(costCenterRateId, actual, "ACCOUNTID"));
}
}
.....