Are you using transactions?  [Rollback] works by setting an ambient
transaction within the execution context of the test thread.  After the test
runs it rolls back the transaction.

Jeff. 

-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of joshlrogers
Sent: Thursday, March 26, 2009 12:26 PM
To: MbUnit.User
Subject: MbUnit Re: Rollback not working


In an effort to try and figure this out when I implemented NHibernate then
Rollback works.  However when I revert to the previous method it still does
not work.

Thanks,
Josh

On Mar 26, 1:47 pm, joshlrogers <[email protected]> wrote:
> Actually, no.  This is a local db installation so it isn't having to 
> go across the network at all.
>
> Josh
>
> On Mar 26, 1:35 pm, "Philip Japikse" <[email protected]> wrote:
>
> > Is the sql server the same machine that you are running the tests 
> > from?  If you are going across machines, the configuration to handle 
> > transactions get's squirly (it's not an MbUnit thing, it's a 
> > security thing)
>
> > Phil
> > Philip Japikse, MCSD.Net, MCDBA, CSM Principal Consultant Pinnacle 
> > Solutions, Inc [email protected]
> > twitter/skimedic
> > (513) 312-5664
>
> > -----Original Message-----
> > From: [email protected] 
> > [mailto:[email protected]] On
>
> > Behalf Of joshlrogers
> > Sent: Thursday, March 26, 2009 10:16 AM
> > To: MbUnit.User
> > Subject: MbUnit Re: Rollback not working
>
> > Sorry for the lack of information.  This is on SQL 2005.
>
> > I have a visual studio generated dataset that I call the stored 
> > procedure from...
>
> >         public int AddCWTRatingGroup(CWTRatingGroup ratingGroup)
> >         {
> >             int? errorNumber = null, id = null;
> >             string errorMessage = string.Empty;
>
> >             _CWTRatingGroupsTableAdapter.AddCWTRatingGroup
> > ( ratingGroup.Name
>
> > ,ratingGroup.UserAdded
> >                                                             ,ref id
> >                                                             ,ref 
> > errorNumber
> >                                                             ,ref 
> > errorMessage);
>
> >             if( errorNumber != null )
> >                 throw new Exception( string.Format( "Error {0}: 
> > {1}", errorNumber, errorMessage ));
>
> >             return (int)id;
>
> >         }
>
> > Thanks,
> > Josh
>
> > On Mar 26, 9:03 am, "Philip Japikse" <[email protected]> wrote:
> > > What is the data store (SQL, Oracle, etc)?  Can you show your DAL
code?
>
> > > Phil
> > > Philip Japikse, MCSD.Net, MCDBA, CSM Principal Consultant Pinnacle 
> > > Solutions, Inc [email protected]
> > > twitter/skimedic
> > > (513) 312-5664
>
> > > -----Original Message-----
> > > From: [email protected] 
> > > [mailto:[email protected]] On
>
> > > Behalf Of joshlrogers
> > > Sent: Thursday, March 26, 2009 9:50 AM
> > > To: MbUnit.User
> > > Subject: MbUnit Rollback not working
>
> > > It is very likely I may be missing something, but I am unable to 
> > > get rollback to successfully work.  Here is my test:
>
> > >         [Test]
> > >         [Rollback]
> > >         public void DoesAddRulesGroupReturnValidValue()
> > >         {
> > >             CWTRatingGroup ratingGroup = new CWTRatingGroup();
>
> > >             ratingGroup.Name = "Test Insertion Group";
> > >             ratingGroup.UserAdded = 1;
>
> > >             object returnVal = _CWTRatingDAL.AddCWTRatingGroup 
> > > (ratingGroup);
>
> > >             Assert.IsInstanceOfType(typeof(int), returnVal);
> > >             Assert.GreaterThanOrEqualTo<int>((int)returnVal,
> > > 0);
>
> > >         }
>
> > > I have tried the Roll back with and without the 
> > > IncludeSetupAndTearDown and there is no change the transaction is 
> > > not rolled back.  Now I am not using anything like NHibernate, I 
> > > am just using my own data access layer.  I am new to TDD 
> > > development and switched to MbUnit from NUnit due to the rollback 
> > > feature, I am hoping I can get it working. Any help would be greatly
appreciated!
>
> > > Thank you in advance,
> > > Josh Rogers


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to