Cherian
Cherian

Reputation: 19418

DataRollBack with XtUnit in Nunit

Today I ran XtUnit at a part of my unit testing framework to to rollback database changes created while running a test case. This is a skeleton of how I have used it. The Test case ran successfully but the database state changed as a result.

using NUnit.Framework;
using TeamAgile.ApplicationBlocks.Interception;
using TeamAgile.ApplicationBlocks.Interception.UnitTestExtensions;

namespace NameSpace.UnitTest
{
  [TestFixture]
  public class Test : InterceptableObject
  {
    [Test]
    [DataRollBack]
    public void CreateTest()
    {

I use Nhibernate with Mysql. Am I missing something?

Upvotes: 0

Views: 742

Answers (2)

Zhenya
Zhenya

Reputation: 181

Database and your program must be run under WindowsXP SP2 oder Server 2003.

Upvotes: 0

Tom Lianza
Tom Lianza

Reputation: 4072

I think your test fixture needs to extend ExtensibleFixture, not InterceptableObject. In the XtUnit source, ExtensibleFixture itself inherits from InterceptableObject. The comments in ExtensibleFixture.cs state:

This is the base class for all the test fixtures you will
have in your project. You MUST inherit from this in order
for the custom attributes to work. No other special action is needed.

Upvotes: 3

Related Questions