diff Agendas/trunk/src/Agendas.Web.Tests/Controllers/EventoControllerTests.cs @ 283:2e17dfd1ba35

Cambiandos espacios por tabuladores, etc.
author juanjose.montesdeocaarbos
date Mon, 26 Dec 2011 14:34:46 -0300
parents d255b0621503
children 79942e030118
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Web.Tests/Controllers/EventoControllerTests.cs	Mon Dec 26 14:21:44 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Web.Tests/Controllers/EventoControllerTests.cs	Mon Dec 26 14:34:46 2011 -0300
@@ -14,33 +14,33 @@
 namespace Agendas.Web.Tests.Controllers
 {
 	[TestFixture]
-	public class EventoControllerTests: MvcControllerTestsBase
+	public class EventoControllerTests : MvcControllerTestsBase
 	{
-        private void PopulatePersona()
-        {
-            using (new RequestEmulator(NhHelper.GetSessionFactory()))
-            {
-                var personaController = new PersonaController();
-                personaController.Nueva(new PersonaNewModel
-                                            {
-                                                Nombre = "Persona 1",
-                                                Blog = "http://blog.persona1.com",
-                                                EMail = "info@persona1.com",
-                                                Roles = new string[] {"Administrador", "Usuario"},
-                                                Twitter = "persona1"
-                                            });
-            }
-        }
+		private void PopulatePersona()
+		{
+			using (new RequestEmulator(NhHelper.GetSessionFactory()))
+			{
+				var personaController = new PersonaController();
+				personaController.Nueva(new PersonaNewModel
+				{
+					Nombre = "Persona 1",
+					Blog = "http://blog.persona1.com",
+					EMail = "info@persona1.com",
+					Roles = new string[] { "Administrador", "Usuario" },
+					Twitter = "persona1"
+				});
+			}
+		}
 
-	    private Guid GetGuidPersona()
-        {
-            using (new RequestEmulator(NhHelper.GetSessionFactory()))
-            {
-                var personaController = new PersonaController();
-                var viewResult = (ViewResult) personaController.Index();
-                return ((PersonaIndexModel) viewResult.Model).Items.FirstOrDefault().Id;
-            }
-        }
+		private Guid GetGuidPersona()
+		{
+			using (new RequestEmulator(NhHelper.GetSessionFactory()))
+			{
+				var personaController = new PersonaController();
+				var viewResult = (ViewResult)personaController.Index();
+				return ((PersonaIndexModel)viewResult.Model).Items.FirstOrDefault().Id;
+			}
+		}
 
 		private void SetearUsuario()
 		{
@@ -49,22 +49,22 @@
 			IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory()));
 		}
 
-        [SetUp]
-        public void Setup()
-        {
-            NhHelperTest.CleanDb();
-            PopulatePersona();
-            SetearUsuario();
-        }
+		[SetUp]
+		public void Setup()
+		{
+			NhHelperTest.CleanDb();
+			PopulatePersona();
+			SetearUsuario();
+		}
 
-        [Test]
-        public void Nuevo_Evento()
-        {
-            //ViewResult viewResult = null;
-            //IEnumerable<EventoDto> eventosDto = null;
-            //EventoPublicarModel eventoPublicar = null;
-            var eventoController = new EventoController { ControllerContext = ControllerCtx };
-            var form = new FormCollection
+		[Test]
+		public void Nuevo_Evento()
+		{
+			//ViewResult viewResult = null;
+			//IEnumerable<EventoDto> eventosDto = null;
+			//EventoPublicarModel eventoPublicar = null;
+			var eventoController = new EventoController { ControllerContext = ControllerCtx };
+			var form = new FormCollection
                            {
                                {"Duracion", (new TimeSpan(0, 0, 0)).ToString()},
                                {"Fecha", (DateTime.Today.AddDays(15)).ToString()},
@@ -73,24 +73,24 @@
                                {"TipoEvento", ((int)TipoEvento.Van).ToString()},
                                {"Titulo", "Título"}
                            };
-            var eventoNew = BindModel<EventoNewModel>(eventoController, form); 
+			var eventoNew = BindModel<EventoNewModel>(eventoController, form);
 
-            using (new RequestEmulator(NhHelper.GetSessionFactory()))
-            {
-                var resultNuevo = eventoController.Nuevo(eventoNew);
-                Assert.IsInstanceOf(typeof(RedirectToRouteResult), resultNuevo);
-                Assert.AreEqual("Index", ((RedirectToRouteResult) resultNuevo).RouteValues["action"]);
-            }
-        }
+			using (new RequestEmulator(NhHelper.GetSessionFactory()))
+			{
+				var resultNuevo = eventoController.Nuevo(eventoNew);
+				Assert.IsInstanceOf(typeof(RedirectToRouteResult), resultNuevo);
+				Assert.AreEqual("Index", ((RedirectToRouteResult)resultNuevo).RouteValues["action"]);
+			}
+		}
 
-        [Test]
-        public void Nuevo_Evento_Erroneo_Sin_Ponente()
-        {
-            //ViewResult viewResult = null;
-            //IEnumerable<EventoDto> eventosDto = null;
-            //EventoPublicarModel eventoPublicar = null;
-            var eventoController = new EventoController { ControllerContext = ControllerCtx };
-            var form = new FormCollection
+		[Test]
+		public void Nuevo_Evento_Erroneo_Sin_Ponente()
+		{
+			//ViewResult viewResult = null;
+			//IEnumerable<EventoDto> eventosDto = null;
+			//EventoPublicarModel eventoPublicar = null;
+			var eventoController = new EventoController { ControllerContext = ControllerCtx };
+			var form = new FormCollection
                            {
                                {"Duracion", (new TimeSpan(0, 0, 0)).ToString()},
                                {"Fecha", (DateTime.Today.AddDays(15)).ToString()},
@@ -98,25 +98,25 @@
                                {"TipoEvento", ((int)TipoEvento.Van).ToString()},
                                {"Titulo", "Título"}
                            };
-            var eventoNew = BindModel<EventoNewModel>(eventoController, form);
+			var eventoNew = BindModel<EventoNewModel>(eventoController, form);
 
-            using (new RequestEmulator(NhHelper.GetSessionFactory()))
-            {
-                var resultNuevo = (ViewResult)eventoController.Nuevo(eventoNew);
-                var modelState = resultNuevo.ViewData.ModelState;
-                Assert.AreEqual(1, modelState[string.Empty].Errors.Count);
-                Assert.AreEqual("Debe indicar el ponente para este tipo de evento", modelState[string.Empty].Errors.FirstOrDefault().ErrorMessage);
-            }
-        }
+			using (new RequestEmulator(NhHelper.GetSessionFactory()))
+			{
+				var resultNuevo = (ViewResult)eventoController.Nuevo(eventoNew);
+				var modelState = resultNuevo.ViewData.ModelState;
+				Assert.AreEqual(1, modelState[string.Empty].Errors.Count);
+				Assert.AreEqual("Debe indicar el ponente para este tipo de evento", modelState[string.Empty].Errors.FirstOrDefault().ErrorMessage);
+			}
+		}
 
-	    [Test]
+		[Test]
 		public void Publicar_Evento_Erroneo_Duracion_Fuera_Rango()
 		{
-		    ViewResult viewResult = null;
-		    IEnumerable<EventoDto> eventosDto = null;
-		    EventoPublicarModel eventoPublicar = null;
-            var eventoController = new EventoController { ControllerContext = ControllerCtx };
-            var formEvento = new FormCollection
+			ViewResult viewResult = null;
+			IEnumerable<EventoDto> eventosDto = null;
+			EventoPublicarModel eventoPublicar = null;
+			var eventoController = new EventoController { ControllerContext = ControllerCtx };
+			var formEvento = new FormCollection
                            {
                                {"Duracion", (new TimeSpan(0, 0, 0)).ToString()},
                                {"Fecha", (DateTime.Today.AddDays(15)).ToString()},
@@ -125,24 +125,24 @@
                                {"TipoEvento", ((int)TipoEvento.Van).ToString()},
                                {"Titulo", "Título 2"}
                            };
-            var eventoNew = BindModel<EventoNewModel>(eventoController, formEvento); 
-		    
+			var eventoNew = BindModel<EventoNewModel>(eventoController, formEvento);
+
+			using (new RequestEmulator(NhHelper.GetSessionFactory()))
+			{
+				eventoController.Nuevo(eventoNew);
+			}
 			using (new RequestEmulator(NhHelper.GetSessionFactory()))
 			{
-			    eventoController.Nuevo(eventoNew);
-			}
-            using (new RequestEmulator(NhHelper.GetSessionFactory()))
-            {
-                viewResult = (ViewResult)eventoController.Index();
+				viewResult = (ViewResult)eventoController.Index();
 			}
-            using (new RequestEmulator(NhHelper.GetSessionFactory()))
-            {
-                eventosDto = ((EventoIndexModel) viewResult.Model).ProximosEventos;
-            }
-            using (new RequestEmulator(NhHelper.GetSessionFactory()))
-            {
-                var firstEvent = eventosDto.LastOrDefault();
-                var formPublicar = new FormCollection
+			using (new RequestEmulator(NhHelper.GetSessionFactory()))
+			{
+				eventosDto = ((EventoIndexModel)viewResult.Model).ProximosEventos;
+			}
+			using (new RequestEmulator(NhHelper.GetSessionFactory()))
+			{
+				var firstEvent = eventosDto.LastOrDefault();
+				var formPublicar = new FormCollection
                            {
                                {"Id", (firstEvent.Id).ToString()},
                                {"Titulo", "Título 2"},
@@ -150,18 +150,18 @@
                                {"UrlWiki", "http://www.altnethistpano.org/vans/titulo-1.ashx"},
                                {"DuracionReal", (new TimeSpan(0, 0, 0)).ToString()}
                            };
-                eventoPublicar = BindModel<EventoPublicarModel>(eventoController, formPublicar); 
-            }
-            using (new RequestEmulator(NhHelper.GetSessionFactory()))
-            {
-                var resultPublicar = (ViewResult)eventoController.Publicar(eventoPublicar);
-                var modelState = resultPublicar.ViewData.ModelState;
+				eventoPublicar = BindModel<EventoPublicarModel>(eventoController, formPublicar);
+			}
+			using (new RequestEmulator(NhHelper.GetSessionFactory()))
+			{
+				var resultPublicar = (ViewResult)eventoController.Publicar(eventoPublicar);
+				var modelState = resultPublicar.ViewData.ModelState;
 
-                Assert.AreEqual(1, modelState[string.Empty].Errors.Count);
-                Assert.AreEqual("Duración fuera de rango", modelState[string.Empty].Errors.FirstOrDefault().ErrorMessage);
-                
-            }
-        }
+				Assert.AreEqual(1, modelState[string.Empty].Errors.Count);
+				Assert.AreEqual("Duración fuera de rango", modelState[string.Empty].Errors.FirstOrDefault().ErrorMessage);
+
+			}
+		}
 	}
 
 }
\ No newline at end of file