Mercurial > altnet-hispano
annotate Agendas/trunk/src/Agendas.Web.Tests/Controllers/EventoControllerTests.cs @ 242:5cc1681d3789
Combinar
author | juanjose.montesdeocaarbos |
---|---|
date | Wed, 05 Oct 2011 07:57:21 -0300 |
parents | a7daa939ef0c 51faeabfb9d9 |
children | 59f8fa2f835e |
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; |
32e4e0e7a140
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff
changeset
|
4 using System.Text; |
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 { |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
19 [SetUp] |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
20 public void SetearUsuario() |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
21 { |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
22 var seguridad = new Mock<ISeguridad>(); |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
23 seguridad.Setup(s => s.GetUserName()).Returns("neluz"); |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
24 IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory())); |
241
a7daa939ef0c
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
233
diff
changeset
|
25 |
237
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
26 } |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
27 |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
28 [Test] |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
29 [Ignore] |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
30 public void Publicar_Evento() |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
31 { |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
32 var eventoController = new EventoController(); |
233
32e4e0e7a140
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff
changeset
|
33 |
237
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
34 var eventoNew = new EventoNewModel |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
35 { |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
36 Duracion = new TimeSpan(0, 0, 0), |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
37 Fecha = DateTime.Today.AddDays(5), |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
38 Hora = new TimeSpan(18, 0, 0), |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
39 Ponentes = new[] {Guid.NewGuid()}, |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
40 TipoEvento = (int) TipoEvento.Van, |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
41 Titulo = "Título 1" |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
42 }; |
233
32e4e0e7a140
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff
changeset
|
43 |
237
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
44 using (new RequestEmulator(NhHelper.GetSessionFactory())) |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
45 { |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
46 var resultNuevo = eventoController.Nuevo(eventoNew); |
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
47 } |
233
32e4e0e7a140
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff
changeset
|
48 |
241
a7daa939ef0c
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
233
diff
changeset
|
49 var eventoPublicar = new EventoPublicarModel |
a7daa939ef0c
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
233
diff
changeset
|
50 { |
a7daa939ef0c
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
233
diff
changeset
|
51 NroOrden = 1, |
a7daa939ef0c
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
233
diff
changeset
|
52 Titulo = "Título 1", |
a7daa939ef0c
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
233
diff
changeset
|
53 UrlWiki = "http://www.altnethistpano.org/vans/titulo-1.ashx", |
a7daa939ef0c
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
233
diff
changeset
|
54 DuracionReal = new TimeSpan(0, 0, 0) |
a7daa939ef0c
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
233
diff
changeset
|
55 }; |
237
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
56 |
241
a7daa939ef0c
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
233
diff
changeset
|
57 using (new RequestEmulator(NhHelper.GetSessionFactory())) |
a7daa939ef0c
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
233
diff
changeset
|
58 { |
a7daa939ef0c
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
233
diff
changeset
|
59 var resultPublicar = eventoController.Publicar(eventoPublicar); |
a7daa939ef0c
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
233
diff
changeset
|
60 } |
233
32e4e0e7a140
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff
changeset
|
61 } |
32e4e0e7a140
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
diff
changeset
|
62 } |
241
a7daa939ef0c
Probando de armar tests de Agendas.Web
juanjose.montesdeocaarbos
parents:
233
diff
changeset
|
63 |
237
51faeabfb9d9
Todos los tests en verde quitando al ponente principal
nelopauselli
parents:
233
diff
changeset
|
64 } |