181
|
1 using System.Collections.Generic;
|
|
2 using Agendas.NHibernate;
|
|
3 using AltNetHispano.Agendas.Domain;
|
|
4 using AltNetHispano.Agendas.Tests.Cruds;
|
|
5 using Moq;
|
|
6 using NUnit.Framework;
|
|
7
|
|
8 namespace AltNetHispano.Agendas.Tests.Workflows
|
|
9 {
|
|
10 [TestFixture]
|
|
11 public class WorkflowNhTests : TestBase
|
|
12 {
|
|
13 private Mock<IPublicador> _publicador;
|
|
14 private Workflow _workflow;
|
|
15
|
|
16 [SetUp]
|
|
17 public void InitPublicador()
|
|
18 {
|
|
19 _publicador = new Mock<IPublicador>();
|
|
20 _workflow = new Workflow(_publicador.Object, DefaultEventoRepository, DefaultPersonaRepository, DefaultPatrocinadorRepository, () => new RequestEmulator(NhHelper.GetSessionFactory()));
|
|
21 }
|
|
22
|
|
23 [Test]
|
|
24 public void Proponer()
|
|
25 {
|
|
26 _workflow.Proponer();
|
|
27 _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Once());
|
|
28 }
|
|
29
|
|
30 [Test]
|
|
31 public void Proponer_y_agendar()
|
|
32 {
|
|
33 _workflow.Proponer();
|
|
34
|
|
35 _workflow.Agendar();
|
|
36
|
|
37 _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(2));
|
|
38 }
|
|
39 [Test]
|
|
40 public void Proponer_agendar_y_cancelar()
|
|
41 {
|
|
42 _workflow.Proponer();
|
|
43
|
|
44 _workflow.Agendar();
|
|
45
|
|
46 _workflow.Cancelar();
|
|
47
|
|
48 _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(3));
|
|
49 }
|
|
50
|
|
51 [Test]
|
|
52 public void Proponer_agendar_cancelar_y_reagendar()
|
|
53 {
|
|
54 _workflow.Proponer();
|
|
55
|
|
56 _workflow.Agendar();
|
|
57
|
|
58 _workflow.Cancelar();
|
|
59
|
|
60 _workflow.ReAgendar();
|
|
61
|
|
62 _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(4));
|
|
63 }
|
|
64
|
|
65 [Test]
|
|
66 public void Proponer_agendar_cancelar_reproponer_agendar_y_confirmar()
|
|
67 {
|
|
68 _workflow.Proponer();
|
|
69
|
|
70 _workflow.Agendar();
|
|
71
|
|
72 _workflow.Cancelar();
|
|
73
|
|
74 _workflow.ReProponer();
|
|
75
|
|
76 _workflow.Agendar();
|
|
77
|
|
78 _workflow.Confirmar();
|
|
79
|
|
80 _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(6));
|
|
81 }
|
|
82
|
|
83 [Test]
|
|
84 public void Proponer_agendar_cancelar_reagendar_y_confirmar()
|
|
85 {
|
|
86 _workflow.Proponer();
|
|
87
|
|
88 _workflow.Agendar();
|
|
89
|
|
90 _workflow.Cancelar();
|
|
91
|
|
92 _workflow.ReAgendar();
|
|
93
|
|
94 _workflow.Confirmar();
|
|
95
|
|
96 _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(5));
|
|
97 }
|
|
98
|
|
99 [Test]
|
|
100 public void Proponer_agendar_cancelar_y_reproponer()
|
|
101 {
|
|
102 _workflow.Proponer();
|
|
103
|
|
104 _workflow.Agendar();
|
|
105
|
|
106 _workflow.Cancelar();
|
|
107
|
|
108 _workflow.ReProponer();
|
|
109
|
|
110 _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(4));
|
|
111 }
|
|
112
|
|
113 [Test]
|
|
114 public void Proponer_y_descartar()
|
|
115 {
|
|
116 _workflow.Proponer();
|
|
117
|
|
118 _workflow.Descartar();
|
|
119 _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(2));
|
|
120 }
|
|
121
|
|
122 [Test]
|
|
123 public void Proponer_agendar_cancelar_y_descartar()
|
|
124 {
|
|
125 _workflow.Proponer();
|
|
126
|
|
127 _workflow.Agendar();
|
|
128
|
|
129 _workflow.Cancelar();
|
|
130
|
|
131 _workflow.Descartar();
|
|
132
|
|
133 _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(4));
|
|
134 }
|
|
135
|
|
136 [Test]
|
|
137 public void Proponer_agendar_y_confirmar()
|
|
138 {
|
|
139 _workflow.Proponer();
|
|
140
|
|
141 _workflow.Agendar();
|
|
142
|
|
143 _workflow.Confirmar();
|
|
144
|
|
145 _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(3));
|
|
146 }
|
|
147
|
|
148 [Test]
|
|
149 public void Proponer_agendar_confirmar_publicar()
|
|
150 {
|
|
151 const string urlWiki = "http://www.altnethispano.org/wiki/van-2010-10-21-mono-cecil.ashx";
|
|
152
|
|
153 _workflow.Proponer();
|
|
154
|
|
155 _workflow.Agendar();
|
|
156
|
|
157 _workflow.Confirmar();
|
|
158
|
|
159 _workflow.Publicar();
|
|
160
|
|
161 _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(4));
|
|
162 }
|
|
163 }
|
|
164 } |