diff Agendas/trunk/src/Agendas.Tests/PersonaServiceTests.cs @ 143:2dbb15f4510f

Asociar Twitter a Persona existente
author Nelo@Guinea.neluz.int
date Mon, 01 Aug 2011 09:41:29 -0300
parents 62dc9fb3a03e
children 5a1f7233aa5a
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Tests/PersonaServiceTests.cs	Mon Aug 01 00:28:04 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Tests/PersonaServiceTests.cs	Mon Aug 01 09:41:29 2011 -0300
@@ -36,6 +36,30 @@
 			Assert.AreEqual(1, persona.Cuentas.Count());
 		}
 
+        [Test]
+        public void Asociar_persona_existente_por_twitter()
+        {
+            var personaRepository = DefaultPersonaRepository;
+
+            personaRepository.Save(new Persona("Mariano Pauselli", "marianopauselli@gmail.com", "marianopauselli", "http://marianopauselli.blogspot.com"));
+            var personaService = new PersonaService(personaRepository);
+
+            Assert.IsTrue(personaService.CreateIfNotExist(IdentityProviderEnum.Twitter, "marianopauselli", "Mariano Pauselli"));
+
+            var persona = personaRepository.GetByNombre("Mariano Pauselli");
+            Assert.IsNotNull(persona);
+            Assert.AreEqual(1, persona.Cuentas.Count());
+            Assert.AreEqual("marianopauselli", persona.Twitter);
+
+            Cuenta cuenta = persona.Cuentas.First();
+            Assert.AreEqual(IdentityProviderEnum.Twitter, cuenta.IdentityProvider);
+            Assert.AreEqual("marianopauselli", cuenta.LogonName);
+
+            Assert.AreEqual(1, persona.Cuentas.Count());
+            Assert.IsTrue(personaService.CreateIfNotExist(IdentityProviderEnum.Twitter, "marianopauselli", "Mariano Pauselli"));
+            Assert.AreEqual(1, persona.Cuentas.Count());
+        }
+
 		[Test]
 		public void IdentificacionGoogle()
 		{