Reputation: 85845
I want to use the role back feature yet when I write the tag it seems to not exists.
I am using nunit 2.5.0
I just used the nunit.framework.dll
Do I need to add some other .dll in?
Also does anyone know how I actually get nunit to connect to a sql sever database in an asp.net application?
I am not sure where to put my connection string.
Upvotes: 6
Views: 2790
Reputation: 398
Old thread, but I thought I'd share for future reference.
As far as I can tell, there isn't a native [Rollback]
attribute. However, you can write your own pretty easily:
This blog post shows how to write a custom rollback attribute for NUnit, so that you can write
[Test, Rollback]
at the beginning of each test (or at the beginning of the TestFixture if you prefer).
It's fairly straightforward, and it uses System.Transaction.TransactionScope()
to do the meat of it.
Of course, you can always just use TransactionScope() in your SetUp/TearDown to accomplish the same thing, see the accepted answer to this question.
Upvotes: 2
Reputation: 2045
The is no such attribute in 2.5 (see here for a list of supported attributes). Read here for the DIY approach.
Upvotes: 1