Mercurial > altnet-hispano
annotate Agendas/trunk/src/Agendas.Web.Tests/Controllers/EventoControllerTests.cs @ 264:cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
author | juanjose.montesdeocaarbos |
---|---|
date | Sat, 22 Oct 2011 17:27:45 -0300 |
parents | bdc946dd5c94 |
children | d255b0621503 |
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] |
264
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
17 public class EventoControllerTests: MvcControllerTestsBase |
237
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 | 60 [Test] |
61 public void Nuevo_Evento() | |
62 { | |
63 ViewResult viewResult = null; | |
64 IEnumerable<EventoDto> eventosDto = null; | |
65 EventoPublicarModel eventoPublicar = null; | |
264
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
66 var eventoController = new EventoController { ControllerContext = ControllerCtx }; |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
67 var form = new FormCollection |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
68 { |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
69 {"Duracion", (new TimeSpan(0, 0, 0)).ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
70 {"Fecha", (DateTime.Today.AddDays(15)).ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
71 {"Hora", (new TimeSpan(18, 0, 0)).ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
72 {"Ponentes", GetGuidPersona().ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
73 {"TipoEvento", ((int)TipoEvento.Van).ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
74 {"Titulo", "Título"} |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
75 }; |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
76 var eventoNew = BindModel<EventoNewModel>(eventoController, form); |
245 | 77 |
78 using (new RequestEmulator(NhHelper.GetSessionFactory())) | |
79 { | |
80 var resultNuevo = eventoController.Nuevo(eventoNew); | |
81 Assert.IsInstanceOf(typeof(RedirectToRouteResult), resultNuevo); | |
82 Assert.AreEqual("Index", ((RedirectToRouteResult) resultNuevo).RouteValues["action"]); | |
83 } | |
84 } | |
85 | |
86 [Test] | |
87 public void Nuevo_Evento_Erroneo_Sin_Ponente() | |
88 { | |
89 ViewResult viewResult = null; | |
90 IEnumerable<EventoDto> eventosDto = null; | |
91 EventoPublicarModel eventoPublicar = null; | |
264
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
92 var eventoController = new EventoController { ControllerContext = ControllerCtx }; |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
93 var form = new FormCollection |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
94 { |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
95 {"Duracion", (new TimeSpan(0, 0, 0)).ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
96 {"Fecha", (DateTime.Today.AddDays(15)).ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
97 {"Hora", (new TimeSpan(18, 0, 0)).ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
98 {"TipoEvento", ((int)TipoEvento.Van).ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
99 {"Titulo", "Título"} |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
100 }; |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
101 var eventoNew = BindModel<EventoNewModel>(eventoController, form); |
245 | 102 |
103 using (new RequestEmulator(NhHelper.GetSessionFactory())) | |
104 { | |
105 var resultNuevo = (ViewResult)eventoController.Nuevo(eventoNew); | |
264
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
106 var modelState = resultNuevo.ViewData.ModelState; |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
107 Assert.AreEqual(1, modelState[string.Empty].Errors.Count); |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
108 Assert.AreEqual("Debe indicar el ponente para este tipo de evento", modelState[string.Empty].Errors.FirstOrDefault().ErrorMessage); |
245 | 109 } |
110 } | |
111 | |
243
59f8fa2f835e
Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents:
242
diff
changeset
|
112 [Test] |
245 | 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; |
264
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
118 var eventoController = new EventoController { ControllerContext = ControllerCtx }; |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
119 var formEvento = new FormCollection |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
120 { |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
121 {"Duracion", (new TimeSpan(0, 0, 0)).ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
122 {"Fecha", (DateTime.Today.AddDays(15)).ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
123 {"Hora", (new TimeSpan(18, 0, 0)).ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
124 {"Ponentes", GetGuidPersona().ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
125 {"TipoEvento", ((int)TipoEvento.Van).ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
126 {"Titulo", "Título 2"} |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
127 }; |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
128 var eventoNew = BindModel<EventoNewModel>(eventoController, formEvento); |
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(); |
264
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
145 var formPublicar = new FormCollection |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
146 { |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
147 {"Id", (firstEvent.Id).ToString()}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
148 {"Titulo", "Título 2"}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
149 {"NroOrden", "1"}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
150 {"UrlWiki", "http://www.altnethistpano.org/vans/titulo-1.ashx"}, |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
151 {"DuracionReal", (new TimeSpan(0, 0, 0)).ToString()} |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
152 }; |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
153 eventoPublicar = BindModel<EventoPublicarModel>(eventoController, formPublicar); |
243
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); |
264
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
158 var modelState = resultPublicar.ViewData.ModelState; |
243
59f8fa2f835e
Ticket 177: Valor de Duración de VAN en 0.
juanjose.montesdeocaarbos
parents:
242
diff
changeset
|
159 |
264
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
160 Assert.AreEqual(1, modelState[string.Empty].Errors.Count); |
cef4fc893333
EventoControllerTests: No se estaba pasando el HttpContext al test.
juanjose.montesdeocaarbos
parents:
245
diff
changeset
|
161 Assert.AreEqual("Duración fuera de rango", modelState[string.Empty].Errors.FirstOrDefault().ErrorMessage); |
243
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 | 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 } |