Mercurial > altnet-hispano
view Agendas/trunk/src/Agendas.Tests/PersonaServiceTests.cs @ 126:6012f2becf97
Se agrega instalación de nuget package para el calendario de google.
author | alabra |
---|---|
date | Tue, 28 Jun 2011 23:35:22 -0400 |
parents | 7a2eeb9e9bf9 |
children | 62dc9fb3a03e |
line wrap: on
line source
using System.Linq; using AltNetHispano.Agendas.Domain; using AltNetHispano.Agendas.Domain.Repositories; using AltNetHispano.Agendas.Domain.Services; using Moq; using NUnit.Framework; namespace AltNetHispano.Agendas.Tests { [TestFixture] public class PersonaServiceTests : TestBase { [Test] public void Crear_nueva_persona() { var personaRepository = new Mock<IPersonaRepository>(); Persona persona=null; personaRepository.Setup(r => r.Save(It.IsAny<Persona>())).Callback<Persona>(p => persona = p); var personaService = new PersonaService(personaRepository.Object); Assert.IsTrue(personaService.CreateIfNotExist(IdentityProviderEnum.Twitter, "nelopauselli", "Nelo Pauselli")); personaRepository.Verify(r=>r.Save(It.IsAny<Persona>()), Times.Once()); Assert.IsNotNull(persona); Assert.AreEqual(1, persona.Cuentas.Count()); Assert.AreEqual("nelopauselli", persona.Twitter); Cuenta cuenta = persona.Cuentas.First(); Assert.AreEqual(IdentityProviderEnum.Twitter, cuenta.IdentityProvider); Assert.AreEqual("nelopauselli", cuenta.LogonName); personaRepository.Setup(r => r.GetCuenta(IdentityProviderEnum.Twitter, "nelopauselli")).Returns(cuenta); Assert.AreEqual(1, persona.Cuentas.Count()); Assert.IsTrue(personaService.CreateIfNotExist(IdentityProviderEnum.Twitter, "nelopauselli", "Nelo Pauselli")); Assert.AreEqual(1, persona.Cuentas.Count()); } [Test] public void IdentificacionBuiltIn() { var builtIn = new Identification(Identification.Map[(int) IdentityProviderEnum.BuiltIn] + "nelo"); Assert.AreEqual(IdentityProviderEnum.BuiltIn, builtIn.IdentityProvider); Assert.AreEqual("nelo", builtIn.LogonName); } [Test] public void IdentificacionTwitter() { var builtIn = new Identification(Identification.Map[(int)IdentityProviderEnum.Twitter] + "nelo"); Assert.AreEqual(IdentityProviderEnum.Twitter, builtIn.IdentityProvider); Assert.AreEqual("nelo", builtIn.LogonName); } } }