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