view Agendas/trunk/src/Agendas.Repositories.Tests/Infraestructure/RequestEmulator.cs @ 222:68b09c30b0d2

Separando los test de persistencia en un proyecto aparte
author nelopauselli
date Mon, 19 Sep 2011 18:18:17 -0300
parents Agendas/trunk/src/Agendas.Tests/Cruds/RequestEmulator.cs@2d1adbaf0373
children
line wrap: on
line source

using System;
using NHibernate;
using NHibernate.Context;

namespace Agendas.Repositories.Tests.Infraestructure
{
	public class RequestEmulator : IDisposable
	{
		private readonly ISession _session;

		public RequestEmulator(ISessionFactory sessionFactory)
		{
			_session = sessionFactory.OpenSession();
			CurrentSessionContext.Bind(_session);
		}

		public void Dispose()
		{
			_session.Flush();
			_session.Close();
		}
	}
}