comparison 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
comparison
equal deleted inserted replaced
236:04d6b386afa7 237:51faeabfb9d9
1 using System; 1 using System;
2 using System.Collections.Generic; 2 using System.Collections.Generic;
3 using System.Linq; 3 using System.Linq;
4 using System.Text; 4 using System.Text;
5 using Agendas.NHibernate;
6 using Agendas.Repositories.Tests.Infraestructure;
5 using AltNetHispano.Agendas.Domain; 7 using AltNetHispano.Agendas.Domain;
8 using AltNetHispano.Agendas.Repositories.NHibernate;
6 using AltNetHispano.Agendas.Web.Controllers; 9 using AltNetHispano.Agendas.Web.Controllers;
7 using AltNetHispano.Agendas.Web.Models; 10 using AltNetHispano.Agendas.Web.Models;
11 using Moq;
8 using NUnit.Framework; 12 using NUnit.Framework;
9 13
10 namespace Agendas.Web.Tests.Controllers 14 namespace Agendas.Web.Tests.Controllers
11 { 15 {
12 [TestFixture] 16 [TestFixture]
13 public class EventoControllerTests 17 public class EventoControllerTests
14 { 18 {
15 [Test] 19 [SetUp]
16 [Ignore] 20 public void SetearUsuario()
17 public void Publicar_Evento() 21 {
18 { 22 var seguridad = new Mock<ISeguridad>();
19 var eventoController = new EventoController(); 23 seguridad.Setup(s => s.GetUserName()).Returns("neluz");
24 IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory()));
25 }
20 26
21 var eventoNew = new EventoNewModel 27 [Test]
22 { 28 [Ignore]
23 Duracion = new TimeSpan(0, 0, 0), 29 public void Publicar_Evento()
24 Fecha = DateTime.Today.AddDays(5), 30 {
25 Hora = new TimeSpan(18, 0, 0), 31 var eventoController = new EventoController();
26 Ponente = new Guid(),
27 TipoEvento = (int)TipoEvento.Van,
28 Titulo = "Título 1"
29 };
30 32
31 var resultNuevo = eventoController.Nuevo(eventoNew); 33 var eventoNew = new EventoNewModel
34 {
35 Duracion = new TimeSpan(0, 0, 0),
36 Fecha = DateTime.Today.AddDays(5),
37 Hora = new TimeSpan(18, 0, 0),
38 Ponentes = new[] {Guid.NewGuid()},
39 TipoEvento = (int) TipoEvento.Van,
40 Titulo = "Título 1"
41 };
32 42
33 //var eventoPublicar = new EventoPublicarModel 43 using (new RequestEmulator(NhHelper.GetSessionFactory()))
34 // { 44 {
35 // NroOrden = 1, 45 var resultNuevo = eventoController.Nuevo(eventoNew);
36 // Titulo = "Título 1", 46 }
37 // UrlWiki = "http://www.altnethistpano.org/vans/titulo-1.ashx",
38 // DuracionReal = new TimeSpan()
39 // };
40 47
41 //var resultPublicar = eventoController.Publicar(eventoPublicar); 48 //var eventoPublicar = new EventoPublicarModel
42 } 49 // {
43 } 50 // NroOrden = 1,
51 // Titulo = "Título 1",
52 // UrlWiki = "http://www.altnethistpano.org/vans/titulo-1.ashx",
53 // DuracionReal = new TimeSpan()
54 // };
55
56 //var resultPublicar = eventoController.Publicar(eventoPublicar);
57 }
58 }
44 } 59 }