annotate Agendas/trunk/src/Agendas.Tests/PulicarTests.cs @ 74:bc46e7426c80

Refactoring de acciones según la definición del diagrama de estados en assembla (https://www.assembla.com/spaces/altnet-hispano/wiki/Estados_de_un_evento)
author nelopauselli
date Mon, 23 May 2011 20:13:37 -0300
parents c7264bfc4b71
children
rev   line source
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
1 using System;
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
2 using System.Linq;
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
3 using AltNetHispano.Agendas.Domain;
50
3ebe89c88caa Agregando propiedad al Evento sobre el Usuario que lo crea o que realizó la
nelopauselli
parents: 45
diff changeset
4 using AltNetHispano.Agendas.Domain.Exceptions;
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
5 using AltNetHispano.Agendas.Domain.Repositories;
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
6 using Moq;
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
7 using NUnit.Framework;
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
8
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
9 namespace AltNetHispano.Agendas.Tests
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
10 {
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
11 [TestFixture]
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
12 public class PulicarTests : TestBase
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
13 {
70
c7264bfc4b71 agregado de properties en clase Evento (UrlInvitacion, UrlWiki, NumeroOrden)
jorge.rowies
parents: 61
diff changeset
14 private const string urlInvitacion = "http://groups.google.com/group/altnet-hispano/browse_thread/thread/65d6d26eb381386e";
c7264bfc4b71 agregado de properties en clase Evento (UrlInvitacion, UrlWiki, NumeroOrden)
jorge.rowies
parents: 61
diff changeset
15
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
16 [Test]
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
17 public void CompositePublicador_constructor_parametro_null_debe_generar_ArgumentNullException()
50
3ebe89c88caa Agregando propiedad al Evento sobre el Usuario que lo crea o que realizó la
nelopauselli
parents: 45
diff changeset
18 {
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
19 Assert.Throws<ArgumentNullException>(() => new CompositePublicador(null));
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
20 }
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
21
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
22 [Test]
51
4a63a73e38e4 Cambio de nombres de test intentando describir mejor lo que verifican
nelopauselli
parents: 50
diff changeset
23 public void Intentar_publicar_evento_donde_ocurre_una_excepcion_no_manejada()
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
24 {
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
25 var publicador = new Mock<IPublicador>();
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
26 var repository = new Mock<IEventoRepository>();
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
27
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
28 publicador.Setup(p => p.Publicar(It.IsAny<Evento>())).Throws(new Exception("Error intencional"));
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
29
50
3ebe89c88caa Agregando propiedad al Evento sobre el Usuario que lo crea o que realizó la
nelopauselli
parents: 45
diff changeset
30 var agenda = new Agenda(publicador.Object, null, repository.Object, DefaultPonenteRepository);
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
31
74
bc46e7426c80 Refactoring de acciones según la definición del diagrama de estados en assembla
nelopauselli
parents: 70
diff changeset
32 Assert.Throws<Exception>(() => agenda.Agendar("Van para publicar", "jjmontes", DateTime.Now, urlInvitacion));
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
33 Assert.AreEqual(0, agenda.GetEventosPublicados().Count);
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
34
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
35 publicador.Verify(p => p.Publicar(It.IsAny<Evento>()), Times.Exactly(1));
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
36 repository.Verify(p => p.Save(It.IsAny<Evento>()), Times.Exactly(0));
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
37 }
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
38
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
39 [Test]
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
40 public void Intentar_publicar_evento_sin_servicio_de_seguridad()
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
41 {
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
42 IdentityContext.Current = null;
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
43
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
44 var publicador = new Mock<IPublicador>();
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
45 var repository = new Mock<IEventoRepository>();
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
46
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
47 var agenda = new Agenda(publicador.Object, null, repository.Object, DefaultPonenteRepository);
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
48
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
49 Assert.Throws<IdentityContextNotConfiguredException>(
74
bc46e7426c80 Refactoring de acciones según la definición del diagrama de estados en assembla
nelopauselli
parents: 70
diff changeset
50 () => agenda.Agendar("Van para publicar", "jjmontes", DateTime.Now,
70
c7264bfc4b71 agregado de properties en clase Evento (UrlInvitacion, UrlWiki, NumeroOrden)
jorge.rowies
parents: 61
diff changeset
51 urlInvitacion));
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
52 repository.Verify(p => p.Save(It.IsAny<Evento>()), Times.Exactly(0));
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
53 }
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
55 [Test]
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
56 public void Intentar_publicar_evento_sin_usuario_autenticado()
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
57 {
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
58 SetCurrentUser(null);
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
59
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
60 var publicador = new Mock<IPublicador>();
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
61 var repository = new Mock<IEventoRepository>();
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
62
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
63 var agenda = new Agenda(publicador.Object, null, repository.Object, DefaultPonenteRepository);
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
64
74
bc46e7426c80 Refactoring de acciones según la definición del diagrama de estados en assembla
nelopauselli
parents: 70
diff changeset
65 Assert.Throws<UsuarioNoAutenticadoException>(() => agenda.Agendar("Van para publicar", "jjmontes", DateTime.Now,
70
c7264bfc4b71 agregado de properties en clase Evento (UrlInvitacion, UrlWiki, NumeroOrden)
jorge.rowies
parents: 61
diff changeset
66 urlInvitacion));
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
67
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
68 publicador.Verify(p => p.Publicar(It.IsAny<Evento>()), Times.Exactly(0));
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
69 repository.Verify(p => p.Save(It.IsAny<Evento>()), Times.Exactly(0));
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
70 }
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
71
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
72 [Test]
59
4a4e12e32256 Poder quitar un ponente de un evento propuesto
nelopauselli
parents: 54
diff changeset
73 public void Intentar_publicar_evento_sin_ponente()
4a4e12e32256 Poder quitar un ponente de un evento propuesto
nelopauselli
parents: 54
diff changeset
74 {
4a4e12e32256 Poder quitar un ponente de un evento propuesto
nelopauselli
parents: 54
diff changeset
75 var agenda = new Agenda(null, null, DefaultEventoRepository, DefaultPonenteRepository);
4a4e12e32256 Poder quitar un ponente de un evento propuesto
nelopauselli
parents: 54
diff changeset
76
74
bc46e7426c80 Refactoring de acciones según la definición del diagrama de estados en assembla
nelopauselli
parents: 70
diff changeset
77 var r = agenda.Agendar("Van para publicar", string.Empty, DateTime.Now,
70
c7264bfc4b71 agregado de properties en clase Evento (UrlInvitacion, UrlWiki, NumeroOrden)
jorge.rowies
parents: 61
diff changeset
78 urlInvitacion);
59
4a4e12e32256 Poder quitar un ponente de un evento propuesto
nelopauselli
parents: 54
diff changeset
79
4a4e12e32256 Poder quitar un ponente de un evento propuesto
nelopauselli
parents: 54
diff changeset
80 Assert.IsFalse(r.Succeful);
4a4e12e32256 Poder quitar un ponente de un evento propuesto
nelopauselli
parents: 54
diff changeset
81 }
4a4e12e32256 Poder quitar un ponente de un evento propuesto
nelopauselli
parents: 54
diff changeset
82
4a4e12e32256 Poder quitar un ponente de un evento propuesto
nelopauselli
parents: 54
diff changeset
83 [Test]
51
4a63a73e38e4 Cambio de nombres de test intentando describir mejor lo que verifican
nelopauselli
parents: 50
diff changeset
84 public void Publicar_evento_con_multiples_publicadores()
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
85 {
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
86 var publicador1 = new Mock<IPublicador>();
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
87 var publicador2 = new Mock<IPublicador>();
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
88
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
89 var repository = new Mock<IEventoRepository>();
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
90
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
91 var agenda = new Agenda(new CompositePublicador(new[] {publicador1.Object, publicador2.Object}), null,
70
c7264bfc4b71 agregado de properties en clase Evento (UrlInvitacion, UrlWiki, NumeroOrden)
jorge.rowies
parents: 61
diff changeset
92 repository.Object, DefaultPonenteRepository);
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
93
74
bc46e7426c80 Refactoring de acciones según la definición del diagrama de estados en assembla
nelopauselli
parents: 70
diff changeset
94 agenda.Agendar("Van para publicar", "jjmontes", DateTime.Now,
70
c7264bfc4b71 agregado de properties en clase Evento (UrlInvitacion, UrlWiki, NumeroOrden)
jorge.rowies
parents: 61
diff changeset
95 urlInvitacion);
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
96
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
97 publicador1.Verify(p => p.Publicar(It.IsAny<Evento>()), Times.Exactly(1));
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
98 publicador2.Verify(p => p.Publicar(It.IsAny<Evento>()), Times.Exactly(1));
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
99 repository.Verify(p => p.Save(It.IsAny<Evento>()), Times.Exactly(1));
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
100 }
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
101
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
102 [Test]
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
103 public void Publicar_evento_correctamente()
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
104 {
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
105 var publicador = new Mock<IPublicador>();
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
106
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
107 var agenda = new Agenda(publicador.Object, null, DefaultEventoRepository, DefaultPonenteRepository);
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
108
74
bc46e7426c80 Refactoring de acciones según la definición del diagrama de estados en assembla
nelopauselli
parents: 70
diff changeset
109 agenda.Agendar("Van para publicar", "jjmontes", DateTime.Now,
70
c7264bfc4b71 agregado de properties en clase Evento (UrlInvitacion, UrlWiki, NumeroOrden)
jorge.rowies
parents: 61
diff changeset
110 urlInvitacion);
61
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 59
diff changeset
111 var eventos = agenda.GetEventosPublicados();
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 59
diff changeset
112 Assert.AreEqual(1, eventos.Count);
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
113
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
114 publicador.Verify(p => p.Publicar(It.IsAny<Evento>()), Times.Exactly(1));
61
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 59
diff changeset
115
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 59
diff changeset
116 var evento = eventos[0];
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 59
diff changeset
117
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 59
diff changeset
118 Assert.IsNotNull(evento.Ponente);
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 59
diff changeset
119 Assert.IsNotNull(evento.Ponente.Eventos);
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 59
diff changeset
120 Assert.AreEqual(1, evento.Ponente.Eventos.Count());
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 59
diff changeset
121 Assert.AreEqual(evento, evento.Ponente.Eventos.First());
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 59
diff changeset
122
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
123 }
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
124
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
125 [Test]
51
4a63a73e38e4 Cambio de nombres de test intentando describir mejor lo que verifican
nelopauselli
parents: 50
diff changeset
126 public void Publicar_y_modificar_evento()
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
127 {
22
d6e124e5c9c4 DefaultEventoRepository en tests
nelo@MTEySS.neluz.int
parents: 21
diff changeset
128 var repository = DefaultEventoRepository;
36
65bbf1ab2b24 cuando se modifica un evento, también debe ser publicada dicha modificación
nelo@MTEySS.neluz.int
parents: 24
diff changeset
129 var publicador = new Mock<IPublicador>();
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
130
50
3ebe89c88caa Agregando propiedad al Evento sobre el Usuario que lo crea o que realizó la
nelopauselli
parents: 45
diff changeset
131 var agenda = new Agenda(publicador.Object, null, repository, DefaultPonenteRepository);
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
132
74
bc46e7426c80 Refactoring de acciones según la definición del diagrama de estados en assembla
nelopauselli
parents: 70
diff changeset
133 agenda.Agendar("Van para publicar", "jjmontes", DateTime.Now,
70
c7264bfc4b71 agregado de properties en clase Evento (UrlInvitacion, UrlWiki, NumeroOrden)
jorge.rowies
parents: 61
diff changeset
134 urlInvitacion);
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
135
36
65bbf1ab2b24 cuando se modifica un evento, también debe ser publicada dicha modificación
nelo@MTEySS.neluz.int
parents: 24
diff changeset
136 publicador.Verify(p => p.Publicar(It.IsAny<Evento>()), Times.Exactly(1));
65bbf1ab2b24 cuando se modifica un evento, también debe ser publicada dicha modificación
nelo@MTEySS.neluz.int
parents: 24
diff changeset
137
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
138 var evento = repository.GetEventosConFecha().First();
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
139 Assert.AreNotEqual(Guid.Empty, evento.Id);
23
a85674a7aa7a ajustes menores en tests
nelo@MTEySS.neluz.int
parents: 22
diff changeset
140 Assert.IsNotNull(evento.Fecha);
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
141
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
142 DateTime fecha = evento.Fecha.Value.AddDays(7);
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
143 agenda.ModificarEvento(evento.Id, "otro titulo", "otro ponente", fecha);
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
144
36
65bbf1ab2b24 cuando se modifica un evento, también debe ser publicada dicha modificación
nelo@MTEySS.neluz.int
parents: 24
diff changeset
145 publicador.Verify(p => p.Publicar(It.IsAny<Evento>()), Times.Exactly(2));
65bbf1ab2b24 cuando se modifica un evento, también debe ser publicada dicha modificación
nelo@MTEySS.neluz.int
parents: 24
diff changeset
146
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
147 evento = repository.GetEventosConFecha().First();
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
148 Assert.AreEqual("otro titulo", evento.Titulo);
24
41b283d27e3e Ponentes como entidad
nelo@MTEySS.neluz.int
parents: 23
diff changeset
149 Assert.AreEqual("otro ponente", evento.Ponente.Nombre);
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
150 Assert.AreEqual(fecha, evento.Fecha);
45
2edc705aae0a Coverage 100% sobre Agendas.Tests
juanjose.montesdeocaarbos
parents: 39
diff changeset
151
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
152 var idEventoNoExistente = new Guid("99999999999999999999999999999999");
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
153 Assert.Throws<EventoNotFoundException>(
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
154 () => agenda.ModificarEvento(idEventoNoExistente, "algún título", "un ponente", DateTime.Now));
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
155 }
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
156
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
157 [Test]
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
158 public void Publicar_y_recordar_evento()
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
159 {
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
160 var publicador1 = new Mock<IPublicador>();
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
161 var publicador2 = new Mock<IPublicador>();
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
162 var recordador1 = new Mock<IRecordador>();
45
2edc705aae0a Coverage 100% sobre Agendas.Tests
juanjose.montesdeocaarbos
parents: 39
diff changeset
163
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
164 var agenda = new Agenda(new CompositePublicador(new[] {publicador1.Object, publicador2.Object}), recordador1.Object,
70
c7264bfc4b71 agregado de properties en clase Evento (UrlInvitacion, UrlWiki, NumeroOrden)
jorge.rowies
parents: 61
diff changeset
165 DefaultEventoRepository, DefaultPonenteRepository);
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
166
74
bc46e7426c80 Refactoring de acciones según la definición del diagrama de estados en assembla
nelopauselli
parents: 70
diff changeset
167 agenda.Agendar("Van para publicar", "jjmontes", DateTime.Now,
70
c7264bfc4b71 agregado de properties en clase Evento (UrlInvitacion, UrlWiki, NumeroOrden)
jorge.rowies
parents: 61
diff changeset
168 urlInvitacion);
54
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
169
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
170 var van = agenda.GetEventosPublicados().Single(v => v.Titulo == "Van para publicar");
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
171 agenda.Recordar(van.Id);
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
172
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
173 publicador1.Verify(p => p.Publicar(It.IsAny<Evento>()), Times.Exactly(1));
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
174 publicador2.Verify(p => p.Publicar(It.IsAny<Evento>()), Times.Exactly(1));
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
175 recordador1.Verify(r => r.Recordar(It.IsAny<Evento>()), Times.Exactly(1));
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
176 }
3059a5f8930f Code cleanup
nelopauselli
parents: 51
diff changeset
177 }
20
c5a99dde072f reorganizando tests
nelo@MTEySS.neluz.int
parents:
diff changeset
178 }