MbUnit & RollBack()

The MbUnit documentation is currently down so I’m stuck here to ponder an oddity of MbUnit. When you want to use the RollBack() attribute you need to reference the MbUnit.Framework.1.1.Dll. This seems a bit weird to me. I’m sure there has to be a better way of doing this but until I find out I’ll be stuck using this reference I guess.

If you came here trying to find information on MbUnit RollBack it’s pretty simple as far as I understand it. Throw a RollBack() attribute into your test and it will rollback any database changes.

You may run into an MS DTC error if you are working against a database that is remote. In this case you’ll need to turn on MS DTC. You can Google how to do this fairly easily so I’m not going to link to any specific article since I can’t vouch for the “best” options to enable. Below is a simple example:

[Test, RollBack]
public void RemoveSeatFrom_ShouldCallDatabaseAndRemoveSeatFromSpecifiedOrder()

MbUnit & RollBack()

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s