I'm testing the MbUnit Framework and want to keep my test database in a persistent state after each test. How can I accomplish this?
This is what I'm trying, but my table is filled after the test is completed.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Gallio.Framework;
using MbUnit.Framework;
using NHibernate;
using NHibernate.Cfg;
namespace BusinessLayer.Tests
{
[TestFixture]
public class PersonNHibernateTests
{
[Test]
[Rollback]
public void CanSavePerson()
{
Configuration config = new Configuration();
config.Configure();
ISessionFactory factory = config.BuildSessionFactory();
using (ISession session = factory.OpenSession())
{
using (ITransaction tx = session.BeginTransaction())
{
const string CONST_STR_FIRSTNAME = "Stephen";
const string CONST_STR_LASTNAME = "Manga";
DateTime birthdate = new DateTime(1974, 6, 20);
Person p = new Person
{
FirstName = CONST_STR_FIRSTNAME,
LastName = CONST_STR_LASTNAME,
Birthdate = birthdate
};
session.SaveOrUpdate(p);
session.Flush();
tx.Commit();
}
}
}
}
}
Edit:
After some reading I've come to the understanding that Distributed Transaction Coordinator has to be enabled. After starting this service and testing still no success :(