diff Agendas/trunk/src/Agendas.Web.Tests/Controllers/EventoControllerTests.cs @ 237:51faeabfb9d9

Todos los tests en verde quitando al ponente principal
author nelopauselli
date Tue, 04 Oct 2011 21:30:55 -0300
parents 32e4e0e7a140
children 5cc1681d3789
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Web.Tests/Controllers/EventoControllerTests.cs	Tue Oct 04 20:42:46 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Web.Tests/Controllers/EventoControllerTests.cs	Tue Oct 04 21:30:55 2011 -0300
@@ -2,43 +2,58 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using Agendas.NHibernate;
+using Agendas.Repositories.Tests.Infraestructure;
 using AltNetHispano.Agendas.Domain;
+using AltNetHispano.Agendas.Repositories.NHibernate;
 using AltNetHispano.Agendas.Web.Controllers;
 using AltNetHispano.Agendas.Web.Models;
+using Moq;
 using NUnit.Framework;
 
 namespace Agendas.Web.Tests.Controllers
 {
-    [TestFixture]
-    public class EventoControllerTests
-    {
-        [Test]
-        [Ignore]
-        public void Publicar_Evento()
-        {
-            var eventoController = new EventoController();
+	[TestFixture]
+	public class EventoControllerTests
+	{
+		[SetUp]
+		public void SetearUsuario()
+		{
+			var seguridad = new Mock<ISeguridad>();
+			seguridad.Setup(s => s.GetUserName()).Returns("neluz");
+			IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory()));
+		}
+
+		[Test]
+		[Ignore]
+		public void Publicar_Evento()
+		{
+			var eventoController = new EventoController();
 
-            var eventoNew = new EventoNewModel
-                                {
-                                    Duracion = new TimeSpan(0, 0, 0),
-                                    Fecha = DateTime.Today.AddDays(5),
-                                    Hora = new TimeSpan(18, 0, 0),
-                                    Ponente = new Guid(),
-                                    TipoEvento = (int)TipoEvento.Van,
-                                    Titulo = "Título 1"
-                                };
-
-            var resultNuevo = eventoController.Nuevo(eventoNew);
+			var eventoNew = new EventoNewModel
+			                	{
+			                		Duracion = new TimeSpan(0, 0, 0),
+			                		Fecha = DateTime.Today.AddDays(5),
+			                		Hora = new TimeSpan(18, 0, 0),
+			                		Ponentes = new[] {Guid.NewGuid()},
+			                		TipoEvento = (int) TipoEvento.Van,
+			                		Titulo = "Título 1"
+			                	};
 
-            //var eventoPublicar = new EventoPublicarModel
-            //                {
-            //                    NroOrden = 1,
-            //                    Titulo = "Título 1",
-            //                    UrlWiki = "http://www.altnethistpano.org/vans/titulo-1.ashx",
-            //                    DuracionReal = new TimeSpan()
-            //                };
+			using (new RequestEmulator(NhHelper.GetSessionFactory()))
+			{
+				var resultNuevo = eventoController.Nuevo(eventoNew);
+			}
 
-            //var resultPublicar = eventoController.Publicar(eventoPublicar);
-        }
-    }
-}
+			//var eventoPublicar = new EventoPublicarModel
+			//                {
+			//                    NroOrden = 1,
+			//                    Titulo = "Título 1",
+			//                    UrlWiki = "http://www.altnethistpano.org/vans/titulo-1.ashx",
+			//                    DuracionReal = new TimeSpan()
+			//                };
+
+			//var resultPublicar = eventoController.Publicar(eventoPublicar);
+		}
+	}
+}
\ No newline at end of file