diff Agendas/trunk/src/Agendas.Tests/PersonaServiceTests.cs @ 219:b9850b647a4e

Agregando alta de ponente durante la carga del evento
author nelopauselli
date Thu, 08 Sep 2011 11:22:10 -0300
parents a36a76bd6ec3
children c61954d24c8c
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Tests/PersonaServiceTests.cs	Thu Sep 08 09:38:47 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Tests/PersonaServiceTests.cs	Thu Sep 08 11:22:10 2011 -0300
@@ -37,6 +37,38 @@
 			Assert.AreEqual(1, persona.Cuentas.Count());
 		}
 
+		[Test]
+		public void Crear_persona_duplicada_por_nombre()
+		{
+			var personaRepository = new Mock<IPersonaRepository>();
+			
+			var persona = new Persona("Nelo Pauselli");
+			personaRepository.Setup(r => r.GetByNombre(It.IsAny<string>())).Returns(persona);
+			var personaService = new PersonaService(personaRepository.Object, DefaultEventoRepository);
+
+			var result = personaService.Add("Nelo Pauselli", "nelopauselli", "nelopauselli@gmail.com", null, null);
+			Assert.IsFalse(result.Succeful);
+			Assert.AreEqual("Ya existe una persona con el nombre Nelo Pauselli", result.Message);
+
+			personaRepository.Verify(r => r.Save(It.IsAny<Persona>()), Times.Never());
+		}
+
+		[Test]
+		public void Crear_persona_duplicada_por_twitter()
+		{
+			var personaRepository = new Mock<IPersonaRepository>();
+
+			var persona = new Persona("Nelo Pauselli");
+			personaRepository.Setup(r => r.GetByTwitter(It.IsAny<string>())).Returns(persona);
+			var personaService = new PersonaService(personaRepository.Object, DefaultEventoRepository);
+
+			var result = personaService.Add("Nelo Pauselli", "nelopauselli", "nelopauselli@gmail.com", null, null);
+			Assert.IsFalse(result.Succeful);
+			Assert.AreEqual("Ya existe una persona con el twitter nelopauselli", result.Message);
+
+			personaRepository.Verify(r => r.Save(It.IsAny<Persona>()), Times.Never());
+		}
+
         [Test]
         public void Asociar_persona_existente_por_twitter()
         {