Say I've written a custom membership provider which extends System.Web.Security.MempershipProvider. This sits in its own project.
overriding the ValidateUser method looks like this:
IList<User> Users;
using (ISession sess = NHibernateHelper.GetCurrentSession())
{
Users = sess.CreateQuery("select u from User as u where u.Username = :username and u.Password = :password")
.SetParameter("username", username)
.SetParameter("password", password)
.List<User>();
}
if (Users.Count > 0)
{
return true;
}
else
{
return false;
}
I'm using fluent nhibernate here so the NHibernateHelper class deals with the configuration of the ISession object.
I want to unit test this method using NUnit. How would I get the method to use a different database configuration (such as an in-memory SQLite DB) when running a test?