Just found this thread on Castle Project: http://forum.castleproject.org/viewtopic.php?t=208&highlight=&sid=c157ca281615681d19b123c98f08a7d7
Seems active record has the same problem (well, AR is just a wrapper around NH) :) Simo On 6/11/07, Simone Chiaretta <[EMAIL PROTECTED]> wrote: > > I use .NET 2.0, so will try the Rollback2 attribute tomorrow... > > If I run NH in not transcational mode, not opening the transaction in the > setup, the I have the error: > System.Runtime.InteropServices > > > > .COMException > > The partner transaction manager has disabled its support for > > remote/network transactions. (Exception from HRESULT: 0x8004D025) > > > Will have a look at the MSDN thread and see if I find something useful... > > > Cheers > Simo > > > > On 6/11/07, Andrew Stopford <[EMAIL PROTECTED]> wrote: > > > > I know very little about about NH so any NH heads here please do wade in > > and give Simone a lift. > > > > Simone, the rollback is likely failing so so the data is being added in > > your test but then MbUnit can't complete the rollback when it's added off to > > COM+ to attempt the rollback. There may be some kind of locking going on > > with both NH and MbUnit trying to talk to the transaction manager. > > > > A few things I would try. > > > > - If it is possible to use .NET 2.0 with what your doing, take a > > look at Rollback2 in MbUnit.Framework.2.0.dll which uses the > > MbUnit.Framework.TransactionScope and may help. > > - If possible run NH in a non transactional mode to see if MbUnit > > if there is a conflict and not a setup or config issue. > > - If the error is still ocurring then its likely a setup or config > > issue > > (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=230390&SiteID=1 > > ) > > > > Again any NH heads I'd appreicate you giving Simone a lift. > > > > Andy > > > > > > On 6/11/07, Simone Chiaretta <[EMAIL PROTECTED] > wrote: > > > > > > Adding a few more info: > > > > > > > > > If I don't call CommitTransaction() at the end then I cannot run other > > > test in the same test fixture because the transaction is already open. > > > > > > If I call RollbackTransaction, the I probably don't need the > > > [RollBack] attribute any more since I'm handling the transaction myself. > > > > > > Is that right? or am I missing something somewhere? > > > Simo > > > > > > On 6/11/07, Simone Chiaretta <[EMAIL PROTECTED] > wrote: > > > > > > > > Hi all, > > > > I'm implementing the DB testing of my application, that uses > > > > NHibernate as persistence method. > > > > > > > > I like the RollBack attribute of MbUnit because I cannot use a real > > > > dev DB, but I can only work on the "testing" db, and I cannot put real > > > > data > > > > on it. > > > > > > > > But it doesn't work with NHibernate. > > > > > > > > let me explain with 2 different examples: > > > > > > > > 1 - Plain test as I used to do using a "normal" Ado repository > > > > > > > > > > > > [TestFixture] > > > > [TestsOn(typeof(UsersPersistenceService))] > > > > public class UserPersistenceFixtures > > > > { > > > > UsersPersistenceService _service; > > > > > > > > [SetUp] > > > > public void SetUp() > > > > { > > > > _service = new UsersPersistenceService(); > > > > } > > > > > > > > > > > > [Test] > > > > [RollBack] > > > > public void AddUser() > > > > { > > > > User target = new User(); > > > > target.Name = "Name"; > > > > target.EmailAddress = " [EMAIL PROTECTED]"; > > > > _service.Add(target); > > > > > > > > User newUser = _service.GetById(target.Id); > > > > > > > > Assert.AreEqual(target.Id, newUser.Id); > > > > Assert.AreEqual("Name", newUser.Name); > > > > } > > > > > > > > [TearDown] > > > > public void TearDown() > > > > { > > > > NHibernateSessionManager.Instance.CloseSession(); > > > > } > > > > > > > > > > > > I get the error: > > > > System.Runtime.InteropServices.COMException > > > > The partner transaction manager has disabled its support for > > > > remote/network transactions. (Exception from HRESULT: 0x8004D025) > > > > > > > > and the test is never executed > > > > > > > > 2 - Open a transaction context on the current NH session > > > > > > > > [TestFixture] > > > > [TestsOn(typeof(UsersPersistenceService))] > > > > public class UserPersistenceFixtures > > > > { > > > > UsersPersistenceService _service; > > > > > > > > [SetUp] > > > > public void SetUp() > > > > { > > > > NHibernateSessionManager.Instance.BeginTransaction(); > > > > _service = new UsersPersistenceService(); > > > > } > > > > > > > > > > > > [Test] > > > > [RollBack] > > > > public void AddUser() > > > > { > > > > User target = new User(); > > > > target.Name = "Name"; > > > > target.EmailAddress = " [EMAIL PROTECTED]"; > > > > _service.Add(target); > > > > > > > > User newUser = _service.GetById(target.Id); > > > > > > > > Assert.AreEqual(target.Id, newUser.Id); > > > > Assert.AreEqual("Name", newUser.Name); > > > > } > > > > > > > > [TearDown] > > > > public void TearDown() > > > > { > > > > NHibernateSessionManager.Instance.CommitTransaction(); > > > > NHibernateSessionManager.Instance.CloseSession(); > > > > } > > > > > > > > The test executes, but the data are store to the db. > > > > > > > > Any idea on how to make it work? Shouldn't the MbUnit rollback > > > > happen before the commit, so rolling back the transaction before the > > > > commit > > > > happens? > > > > > > > > Cheers > > > > Simone > > > > > > > > -- > > > > Simone Chiaretta > > > > codeclimber.net.nz > > > > Any sufficiently advanced technology is indistinguishable from magic > > > > > > > > "Life is short, play hard" > > > > > > > > > > > > > > > > > -- > > > Simone Chiaretta > > > codeclimber.net.nz > > > Any sufficiently advanced technology is indistinguishable from magic > > > "Life is short, play hard" > > > > > > > > > > > > -- > Simone Chiaretta > codeclimber.net.nz > Any sufficiently advanced technology is indistinguishable from magic > "Life is short, play hard" > -- Simone Chiaretta codeclimber.net.nz Any sufficiently advanced technology is indistinguishable from magic "Life is short, play hard" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MbUnit.User" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/MbUnitUser?hl=en -~----------~----~----~----~------~----~------~--~---
