Hi,
I am trying to set up a continuous integration server that not surprisingly has a collection of Unit tests that uses the NUnit framework.
All my tests run fine when I run them individually but when I run the whole testsuite I run into into session problems.
I am getting some errors such as:
Quote:
object references an unsaved transient instance - save the transient instance before flushing:
Or a very strange one happens in the following circumstances:
UnitTest1 is testing for an expected exception and does not commit a saveorupdate.
UnitTest2 is doing a Criteria.List and I get an exception telling me it could not insert the data from UnitTest1.
I get the following error
Quote:
tests.people.PeopleControllerTest.SiteGetAll : could not insert: [continuity2.core.domain.Site#d0842278-3d8e-429a-8efc-9863fa9e2501][SQL: INSERT INTO Sites (name, deleted, companyuid, businessunituid, ssid, Uid) VALUES (?, ?, ?, ?, ?, ?)]
I have tried adding the following StartUp and TearDown procedures but I am getting nowhere fast.
Code:
[SetUp]
public void Init()
{
SetUserToSystemAdmin();
_peopleController = _container.Resolve<PeopleController>();
_activeCompany = GetFirstItem<Company>();
Assert.IsNotNull(_activeCompany);
_context = _container.Resolve<IContext>();
_session = _sessionFactory.OpenSession();
_contactController = _container.Resolve<ContactController>();
}
[TearDown]
public void Dispose()
{
try
{
Company company = _commonService.GetObjectByDescription<Company>("Name", COMPANY_NAME);
if(company != null)
_peopleController.DeleteCompany(company.Uid);
if(_session != null)
{
_session.Flush();
_session.Clear();
_session.Dispose();
}
}
catch
{
//do nothing
}
}
I am using the Caslte.Services.Transaction transaction attributes my NHibernate Crud operations.
Can anyone help me out as to WTF is going on here?
Thanks
Paul