diff 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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Repositories.Tests/Infraestructure/RequestEmulator.cs	Mon Sep 19 18:18:17 2011 -0300
@@ -0,0 +1,23 @@
+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();
+		}
+	}
+}
\ No newline at end of file