In writing a unit test for an Orchard module, I would like to use the previously stored data present in Orchard's database.
I have a module in orchard that is storing non content data in two tables (UserRecord, AccessRecord). This two tables are populated with data by using a migration class. I can read these data from Microsoft SQL Server Management Studio.
The problem now is that I want to access to this data also from my unit test.
The key part in configuring my unit test is to open a session (Issession).
I do this by creating a new session factory with:
ISessionFactory _sessionFactory = DataUtility.CreateSessionFactory(
and then opening a session with
ISession _session = _sessionFactory.OpenSession();
As I understood, the problem is that creating a sesssion factory means creating a temporary empty database -> no previous data.
Of course, I could popolate the temporary database before any test call but this seems a little messy.
Is there a way to open the same session as in Orchard?