diff Agendas/trunk/src/Agendas.Tests/Cruds/PatrocinadorCrudNhTests.cs @ 137:2d1adbaf0373

CRUD de Patrocinador
author nelopauselli
date Thu, 28 Jul 2011 09:26:24 -0300
parents
children 5346c0500594
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Tests/Cruds/PatrocinadorCrudNhTests.cs	Thu Jul 28 09:26:24 2011 -0300
@@ -0,0 +1,69 @@
+using Agendas.NHibernate;
+using AltNetHispano.Agendas.Domain;
+using AltNetHispano.Agendas.Repositories.NHibernate;
+using Moq;
+using NHibernate;
+using NHibernate.Cfg;
+using NHibernate.Tool.hbm2ddl;
+using NUnit.Framework;
+
+namespace AltNetHispano.Agendas.Tests.Cruds
+{
+	[TestFixture]
+	public class PatrocinadorCrudNhTests
+	{
+		private PatrocinadorCrud _patrocinadorCrud;
+
+		#region SetUp
+
+		[SetUp]
+		public void BorrarRepositorios()
+		{
+			Configuration cfg = NhHelper.GetConfiguration();
+			var schemaExport = new SchemaExport(cfg);
+			schemaExport.Create(false, true);
+		}
+
+		[SetUp]
+		public void SetearUsuario()
+		{
+			var seguridad = new Mock<ISeguridad>();
+			seguridad.Setup(s => s.GetUserName()).Returns("neluz");
+			IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory()));
+		}
+
+		[SetUp]
+		public void CreateCrud()
+		{
+			ISessionFactory sessionFactory = NhHelper.GetSessionFactory();
+			_patrocinadorCrud = new PatrocinadorCrud(() => new PatrocinadorRepository(sessionFactory), () => new RequestEmulator(sessionFactory));
+		}
+
+		#endregion
+
+		[Test]
+		public void Create()
+		{
+			_patrocinadorCrud.Create();
+		}
+
+		[Test]
+		public void Read()
+		{
+			_patrocinadorCrud.Read();
+		}
+
+		[Test]
+		public void Update()
+		{
+			_patrocinadorCrud.Update();
+		}
+
+		[Test]
+		public void Delete()
+		{
+			_patrocinadorCrud.Delete();
+		}
+
+	}
+}
\ No newline at end of file