annotate Agendas/trunk/src/Agendas.Web.Tests/Controllers/EventoControllerTests.cs @ 245:bdc946dd5c94

Agregando Tests a Agenda.Web
author juanjose.montesdeocaarbos
date Fri, 07 Oct 2011 09:41:55 -0300
parents 59f8fa2f835e
children cef4fc893333
rev   line source
233
32e4e0e7a140 Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff changeset
1 using System;
32e4e0e7a140 Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff changeset
2 using System.Collections.Generic;
32e4e0e7a140 Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff changeset
3 using System.Linq;
243
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
4 using System.Web.Mvc;
237
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
5 using Agendas.NHibernate;
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
6 using Agendas.Repositories.Tests.Infraestructure;
233
32e4e0e7a140 Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff changeset
7 using AltNetHispano.Agendas.Domain;
237
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
8 using AltNetHispano.Agendas.Repositories.NHibernate;
233
32e4e0e7a140 Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff changeset
9 using AltNetHispano.Agendas.Web.Controllers;
32e4e0e7a140 Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff changeset
10 using AltNetHispano.Agendas.Web.Models;
237
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
11 using Moq;
233
32e4e0e7a140 Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff changeset
12 using NUnit.Framework;
32e4e0e7a140 Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff changeset
13
32e4e0e7a140 Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff changeset
14 namespace Agendas.Web.Tests.Controllers
32e4e0e7a140 Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff changeset
15 {
237
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
16 [TestFixture]
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
17 public class EventoControllerTests
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
18 {
243
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
19 private void PopulatePersona()
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
20 {
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
21 using (new RequestEmulator(NhHelper.GetSessionFactory()))
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
22 {
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
23 var personaController = new PersonaController();
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
24 personaController.Nueva(new PersonaNewModel
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
25 {
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
26 Nombre = "Persona 1",
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
27 Blog = "http://blog.persona1.com",
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
28 EMail = "info@persona1.com",
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
29 Roles = new string[] {"Administrador", "Usuario"},
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
30 Twitter = "persona1"
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
31 });
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
32 }
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
33 }
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
34
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
35 private Guid GetGuidPersona()
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
36 {
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
37 using (new RequestEmulator(NhHelper.GetSessionFactory()))
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
38 {
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
39 var personaController = new PersonaController();
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
40 var viewResult = (ViewResult) personaController.Index();
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
41 return ((PersonaIndexModel) viewResult.Model).Items.FirstOrDefault().Id;
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
42 }
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
43 }
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
44
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
45 private void SetearUsuario()
237
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
46 {
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
47 var seguridad = new Mock<ISeguridad>();
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
48 seguridad.Setup(s => s.GetUserName()).Returns("neluz");
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
49 IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory()));
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
50 }
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
51
243
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
52 [SetUp]
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
53 public void Setup()
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
54 {
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
55 NhHelperTest.CleanDb();
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
56 PopulatePersona();
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
57 SetearUsuario();
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
58 }
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
59
245
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
60 [Test]
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
61 public void Nuevo_Evento()
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
62 {
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
63 ViewResult viewResult = null;
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
64 IEnumerable<EventoDto> eventosDto = null;
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
65 EventoPublicarModel eventoPublicar = null;
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
66 var eventoController = new EventoController();
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
67
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
68 var eventoNew = new EventoNewModel
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
69 {
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
70 Duracion = new TimeSpan(0, 0, 0),
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
71 Fecha = DateTime.Today.AddDays(15),
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
72 Hora = new TimeSpan(18, 0, 0),
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
73 Ponentes = new[] { GetGuidPersona() },
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
74 TipoEvento = (int)TipoEvento.Van,
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
75 Titulo = "Título"
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
76 };
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
77
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
78 using (new RequestEmulator(NhHelper.GetSessionFactory()))
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
79 {
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
80 var resultNuevo = eventoController.Nuevo(eventoNew);
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
81 Assert.IsInstanceOf(typeof(RedirectToRouteResult), resultNuevo);
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
82 Assert.AreEqual("Index", ((RedirectToRouteResult) resultNuevo).RouteValues["action"]);
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
83 }
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
84 }
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
85
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
86 [Test]
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
87 public void Nuevo_Evento_Erroneo_Sin_Ponente()
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
88 {
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
89 ViewResult viewResult = null;
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
90 IEnumerable<EventoDto> eventosDto = null;
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
91 EventoPublicarModel eventoPublicar = null;
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
92 var eventoController = new EventoController();
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
93
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
94 var eventoNew = new EventoNewModel
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
95 {
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
96 Duracion = new TimeSpan(0, 0, 0),
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
97 Fecha = DateTime.Today.AddDays(15),
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
98 Hora = new TimeSpan(18, 0, 0),
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
99 TipoEvento = (int)TipoEvento.Van,
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
100 Titulo = "Título"
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
101 };
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
102
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
103 using (new RequestEmulator(NhHelper.GetSessionFactory()))
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
104 {
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
105 var resultNuevo = (ViewResult)eventoController.Nuevo(eventoNew);
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
106 var modelState = resultNuevo.ViewData.ModelState.FirstOrDefault().Value;
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
107 Assert.AreEqual(1, modelState.Errors.Count);
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
108 Assert.AreEqual("Debe indicar el ponente para este tipo de evento", modelState.Errors.FirstOrDefault().ErrorMessage);
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
109 }
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
110 }
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
111
243
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
112 [Test]
245
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
113 public void Publicar_Evento_Erroneo_Duracion_Fuera_Rango()
237
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
114 {
243
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
115 ViewResult viewResult = null;
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
116 IEnumerable<EventoDto> eventosDto = null;
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
117 EventoPublicarModel eventoPublicar = null;
237
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
118 var eventoController = new EventoController();
233
32e4e0e7a140 Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff changeset
119
237
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
120 var eventoNew = new EventoNewModel
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
121 {
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
122 Duracion = new TimeSpan(0, 0, 0),
243
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
123 Fecha = DateTime.Today.AddDays(15),
237
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
124 Hora = new TimeSpan(18, 0, 0),
243
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
125 Ponentes = new[] { GetGuidPersona()},
237
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
126 TipoEvento = (int) TipoEvento.Van,
243
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
127 Titulo = "Título 2"
237
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
128 };
243
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
129
237
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
130 using (new RequestEmulator(NhHelper.GetSessionFactory()))
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
131 {
243
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
132 eventoController.Nuevo(eventoNew);
237
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
133 }
243
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
134 using (new RequestEmulator(NhHelper.GetSessionFactory()))
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
135 {
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
136 viewResult = (ViewResult)eventoController.Index();
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
137 }
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
138 using (new RequestEmulator(NhHelper.GetSessionFactory()))
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
139 {
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
140 eventosDto = ((EventoIndexModel) viewResult.Model).ProximosEventos;
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
141 }
241
a7daa939ef0c Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents: 233
diff changeset
142 using (new RequestEmulator(NhHelper.GetSessionFactory()))
a7daa939ef0c Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents: 233
diff changeset
143 {
243
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
144 var firstEvent = eventosDto.LastOrDefault();
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
145
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
146 eventoPublicar = new EventoPublicarModel
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
147 {
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
148 Id = firstEvent.Id,
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
149 NroOrden = 1,
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
150 //Titulo = "Título 2",
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
151 UrlWiki = "http://www.altnethistpano.org/vans/titulo-1.ashx",
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
152 DuracionReal = new TimeSpan(0, 0, 0)
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
153 };
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
154 }
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
155 using (new RequestEmulator(NhHelper.GetSessionFactory()))
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
156 {
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
157 var resultPublicar = (ViewResult)eventoController.Publicar(eventoPublicar);
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
158 var modelState = resultPublicar.ViewData.ModelState.FirstOrDefault().Value;
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
159
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
160 Assert.AreEqual(1, modelState.Errors.Count);
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
161 Assert.AreEqual("Duración fuera de rango", modelState.Errors.FirstOrDefault().ErrorMessage);
59f8fa2f835e Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents: 242
diff changeset
162
241
a7daa939ef0c Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents: 233
diff changeset
163 }
233
32e4e0e7a140 Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff changeset
164 }
245
bdc946dd5c94 Agregando Tests a Agenda.Web
juanjose.montesdeocaarbos
parents: 243
diff changeset
165 }
241
a7daa939ef0c Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents: 233
diff changeset
166
237
51faeabfb9d9 Todos los tests en verde quitando al ponente principal
nelopauselli
parents: 233
diff changeset
167 }