Mercurial > altnet-hispano
diff Agendas/trunk/src/Agendas.Tests/Workflows/WorkflowMemoryTests.cs @ 181:6ee05ceea8c3
Implementando test de workflow también con nh
author | nelopauselli |
---|---|
date | Mon, 08 Aug 2011 20:08:31 -0300 |
parents | |
children | 5346c0500594 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Tests/Workflows/WorkflowMemoryTests.cs Mon Aug 08 20:08:31 2011 -0300 @@ -0,0 +1,165 @@ +using System; +using System.Collections.Generic; +using AltNetHispano.Agendas.Domain; +using Moq; +using NUnit.Framework; + +namespace AltNetHispano.Agendas.Tests.Workflows +{ + [TestFixture] + public class WorkflowMemoryTests : TestBase + { + private Mock<IPublicador> _publicador; + private Workflow _workflow; + + [SetUp] + public void InitPublicador() + { + _publicador = new Mock<IPublicador>(); + _workflow = new Workflow(_publicador.Object, DefaultEventoRepository, DefaultPersonaRepository, + DefaultPatrocinadorRepository, () => new Mock<IDisposable>().Object); + } + + [Test] + public void Proponer() + { + _workflow.Proponer(); + _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Once()); + } + + [Test] + public void Proponer_y_agendar() + { + _workflow.Proponer(); + + _workflow.Agendar(); + + _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(2)); + } + + [Test] + public void Proponer_agendar_y_cancelar() + { + _workflow.Proponer(); + + _workflow.Agendar(); + + _workflow.Cancelar(); + + _publicador.Verify(p=>p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(3)); + } + + [Test] + public void Proponer_agendar_cancelar_y_reagendar() + { + _workflow.Proponer(); + + _workflow.Agendar(); + + _workflow.Cancelar(); + + _workflow.ReAgendar(); + + _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(4)); + } + + [Test] + public void Proponer_agendar_cancelar_reproponer_agendar_y_confirmar() + { + _workflow.Proponer(); + + _workflow.Agendar(); + + _workflow.Cancelar(); + + _workflow.ReProponer(); + + _workflow.Agendar(); + + _workflow.Confirmar(); + + _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(6)); + } + + [Test] + public void Proponer_agendar_cancelar_reagendar_y_confirmar() + { + _workflow.Proponer(); + + _workflow.Agendar(); + + _workflow.Cancelar(); + + _workflow.ReAgendar(); + + _workflow.Confirmar(); + + _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(5)); + } + + [Test] + public void Proponer_agendar_cancelar_y_reproponer() + { + _workflow.Proponer(); + + _workflow.Agendar(); + + _workflow.Cancelar(); + + _workflow.ReProponer(); + + _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(4)); + } + + [Test] + public void Proponer_y_descartar() + { + _workflow.Proponer(); + + _workflow.Descartar(); + _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(2)); + } + + [Test] + public void Proponer_agendar_cancelar_y_descartar() + { + _workflow.Proponer(); + + _workflow.Agendar(); + + _workflow.Cancelar(); + + _workflow.Descartar(); + + _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(4)); + } + + [Test] + public void Proponer_agendar_y_confirmar() + { + _workflow.Proponer(); + + _workflow.Agendar(); + + _workflow.Confirmar(); + + _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(3)); + } + + [Test] + public void Proponer_agendar_confirmar_publicar() + { + const string urlWiki = "http://www.altnethispano.org/wiki/van-2010-10-21-mono-cecil.ashx"; + + _workflow.Proponer(); + + _workflow.Agendar(); + + _workflow.Confirmar(); + + _workflow.Publicar(); + + _publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(4)); + } + } +} \ No newline at end of file