Mercurial > altnet-hispano
changeset 222:68b09c30b0d2
Separando los test de persistencia en un proyecto aparte
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Domain/Repositories/IEventoRepository.cs Tue Sep 13 09:01:58 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Domain/Repositories/IEventoRepository.cs Mon Sep 19 18:18:17 2011 -0300 @@ -15,4 +15,20 @@ void Update(Evento evento); bool ExistePonente(Persona ponente); } + + public class EventoStateRepository + { + public static IEnumerable<EventoState> All + { + get + { + return new[] + { + EventoNullState.GetInstance(), EventoPropuestoState.GetInstance(), EventoAgendadoState.GetInstance(), + EventoConfirmadoState.GetInstance(), EventoPublicadoState.GetInstance(), EventoCanceladoState.GetInstance(), + EventoDescartadoState.GetInstance() + }; + } + } + } } \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Factories/Agendas.Factories.csproj Tue Sep 13 09:01:58 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Factories/Agendas.Factories.csproj Mon Sep 19 18:18:17 2011 -0300 @@ -31,10 +31,13 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="NHibernate"> - <HintPath>..\packages\NHibernate.3.1.0.4000\lib\Net35\NHibernate.dll</HintPath> - </Reference> - <Reference Include="System" /> + <Reference Include="Iesi.Collections"> + <HintPath>..\packages\Iesi.Collections.3.1.0.4000\lib\Net35\Iesi.Collections.dll</HintPath> + </Reference> + <Reference Include="NHibernate"> + <HintPath>..\packages\NHibernate.3.1.0.4000\lib\Net35\NHibernate.dll</HintPath> + </Reference> + <Reference Include="System" /> <Reference Include="System.Core" /> <Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> <Reference Include="System.Xml.Linq" /> @@ -74,6 +77,9 @@ <Name>Agendas.Twitter</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Factories/packages.config Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Iesi.Collections" version="3.1.0.4000" /> + <package id="NHibernate" version="3.1.0.4000" /> +</packages> \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.NHibernate/EventoStateType.cs Tue Sep 13 09:01:58 2011 -0300 +++ b/Agendas/trunk/src/Agendas.NHibernate/EventoStateType.cs Mon Sep 19 18:18:17 2011 -0300 @@ -1,26 +1,13 @@ -using System.Collections.Generic; -using AltNetHispano.Agendas.Domain; +using AltNetHispano.Agendas.Domain; +using AltNetHispano.Agendas.Domain.Repositories; using NHibernate.SqlTypes; namespace Agendas.NHibernate { public class EventoStateType : GenericWellKnownInstanceType<EventoState, string> { - public static IEnumerable<EventoState> All - { - get - { - return new[] - { - EventoNullState.GetInstance(), EventoPropuestoState.GetInstance(), EventoAgendadoState.GetInstance(), - EventoConfirmadoState.GetInstance(), EventoPublicadoState.GetInstance(), EventoCanceladoState.GetInstance(), - EventoDescartadoState.GetInstance() - }; - } - } - public EventoStateType() - : base(All, (state, id) => state.Descripcion == id, state => state.Descripcion) + : base(EventoStateRepository.All, (state, id) => state.Descripcion == id, state => state.Descripcion) { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/Agendas.Repositories.Tests.csproj Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{BFCD197C-01D5-4645-B0DF-053867E16FDE}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Agendas.Repositories.Tests</RootNamespace> + <AssemblyName>Agendas.Repositories.Tests</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Moq"> + <HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath> + </Reference> + <Reference Include="nunit.framework"> + <HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath> + </Reference> + <Reference Include="nunit.mocks"> + <HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.mocks.dll</HintPath> + </Reference> + <Reference Include="pnunit.framework"> + <HintPath>..\packages\NUnit.2.5.10.11092\lib\pnunit.framework.dll</HintPath> + </Reference> + <Reference Include="Iesi.Collections"> + <HintPath>..\packages\Iesi.Collections.3.1.0.4000\lib\Net35\Iesi.Collections.dll</HintPath> + </Reference> + <Reference Include="NHibernate"> + <HintPath>..\packages\NHibernate.3.1.0.4000\lib\Net35\NHibernate.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="EventoCrud.cs" /> + <Compile Include="EventoCrudMemory.cs" /> + <Compile Include="EventoCrudNh.cs" /> + <Compile Include="Infraestructure\IInfraestrutureFactory.cs" /> + <Compile Include="Infraestructure\MemoryInfraestrutureFactory.cs" /> + <Compile Include="Infraestructure\NhHelperTest.cs" /> + <Compile Include="Infraestructure\NhInfraestrutureFactory.cs" /> + <Compile Include="Infraestructure\RequestEmulator.cs" /> + <Compile Include="PatrocinadorCrud.cs" /> + <Compile Include="PatrocinadorCrudMemoryTests.cs" /> + <Compile Include="PatrocinadorCrudNhTests.cs" /> + <Compile Include="PersonaCrud.cs" /> + <Compile Include="PersonaCrudMemoryTests.cs" /> + <Compile Include="PersonaCrudNhTests.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="SchemaNhTests.cs" /> + <Compile Include="TestsHelper.cs" /> + <Compile Include="Workflow.cs" /> + <Compile Include="WorkflowMemoryTests.cs" /> + <Compile Include="WorkflowNhTests.cs" /> + <Compile Include="WorkflowTests.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Agendas.Domain\Agendas.Domain.csproj"> + <Project>{A14907DF-02E4-4FA7-BE27-4292AF50AA22}</Project> + <Name>Agendas.Domain</Name> + </ProjectReference> + <ProjectReference Include="..\Agendas.NHibernate\Agendas.NHibernate.csproj"> + <Project>{9519A43A-9D5E-4BFD-9F88-AFFC53C9973A}</Project> + <Name>Agendas.NHibernate</Name> + </ProjectReference> + <ProjectReference Include="..\Agendas.Repositories.Memory\Agendas.Repositories.Memory.csproj"> + <Project>{28C5EBFB-EE69-4765-A880-D4DE0BC89F48}</Project> + <Name>Agendas.Repositories.Memory</Name> + </ProjectReference> + <ProjectReference Include="..\Agendas.Repositories.NHibernate\Agendas.Repositories.NHibernate.csproj"> + <Project>{0973DF44-3B90-4D2A-B579-C64C93B6C853}</Project> + <Name>Agendas.Repositories.NHibernate</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <Content Include="hibernate.cfg.xml"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <PropertyGroup> + <PostBuildEvent>copy "$(SolutionDir)packages\NHibernate.Castle.3.1.0.4000\lib\Net35\NHibernate.ByteCode.Castle.dll" "$(TargetDir)" & +copy "$(SolutionDir)packages\Castle.Core.2.5.2\lib\NET35\Castle.Core.dll" "$(TargetDir)"</PostBuildEvent> + </PropertyGroup> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/App.config Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <configSections> + <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> + </configSections> + + <connectionStrings> + <add name="AltNetHispano" connectionString="Data Source=.\sqlexpress;Initial Catalog=AltNetHispano_Test;Integrated Security=SSPI"/> + </connectionStrings> + + <log4net> + <appender name="FileAppender" type="log4net.Appender.FileAppender"> + <file value="${TMP}\log-file.txt" /> + <appendToFile value="true" /> + <layout type="log4net.Layout.PatternLayout"> + <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" /> + </layout> + </appender> + + <root> + <level value="INFO" /> + <appender-ref ref="FileAppender" /> + </root> + </log4net> +</configuration> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/EventoCrud.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,186 @@ +using System; +using System.Linq; +using Agendas.Repositories.Tests.Infraestructure; +using AltNetHispano.Agendas.Domain; +using AltNetHispano.Agendas.Domain.Repositories; +using Moq; +using NUnit.Framework; + +namespace Agendas.Repositories.Tests +{ + public abstract class EventoCrud<T> where T : IInfraestrutureFactory, new() + { + private readonly IEventoRepository _eventoRepository; + private readonly Func<IDisposable> _requestEmulator; + private readonly IPersonaRepository _personaRepository; + + protected EventoCrud() + { + var infraestrutureFactory = new T(); + + _eventoRepository = infraestrutureFactory.GetEventoRepository(); + _personaRepository = infraestrutureFactory.GetPonenteRepository(); + _requestEmulator = infraestrutureFactory.GetRequestEmulator(); + } + + [SetUp] + public void SetearUsuario() + { + var seguridad = new Mock<ISeguridad>(); + seguridad.Setup(s => s.GetUserName()).Returns("neluz"); + IdentityContext.Init(seguridad.Object, _personaRepository); + } + + [Test] + public void Create() + { + Assert.AreNotEqual(Guid.Empty, CreateEvento()); + } + + private Guid CreateEvento() + { + using (_requestEmulator.Invoke()) + { + var ponente = new Persona("Carlos Blé") {Twitter = "carlosble"}; + _personaRepository.Save(ponente); + + var usuario = new Persona("Nelo") {Twitter = "nelopauselli"}; + _personaRepository.Save(usuario); + + var evento = Evento.Proponer("TDD - Diseño Basado en Ejemplos", ponente, string.Empty, TipoEvento.Van); + evento.Tracks.First().LogAdd(new TrackLog(TrackLogPropietario.Twitter, "Mensaje", usuario, true)); + + _eventoRepository.Save(evento); + + return evento.Id; + } + } + + [Test] + public void Read() + { + Guid eventoId = CreateEvento(); + + using (_requestEmulator.Invoke()) + { + Evento van = _eventoRepository.Get(eventoId); + + Assert.IsNotNull(van); + Assert.IsNotNull(van.Ponente); + Assert.AreEqual("Carlos Blé", van.Ponente.Nombre); + + var track1 = van.Tracks.Where(t => t.Accion == Accion.Proponer).FirstOrDefault(); + Assert.IsNotNull(track1); + Assert.AreEqual(van, track1.Evento); + + Assert.AreEqual("TDD - Diseño Basado en Ejemplos", van.Titulo); + } + } + + [Test] + public void Update() + { + Guid eventoId = CreateEvento(); + var fechaInicio = new DateTime(2010, 04, 17).ToUniversalTime(); + var fechaTermino = fechaInicio.AddHours(2); + + using (_requestEmulator.Invoke()) + { + Evento van = _eventoRepository.Get(eventoId); + + Assert.IsNotNull(van); + + van.CambiarTitulo("TDD & Ejemplos"); + + var otroPonente = new Persona("José"); + _personaRepository.Save(otroPonente); + + van.Actualizar(otroPonente, fechaInicio, fechaTermino, null); + + _eventoRepository.Update(van); + } + + using (_requestEmulator.Invoke()) + { + Evento van = _eventoRepository.Get(eventoId); + + Assert.IsNotNull(van); + Assert.IsNotNull(van.Ponente); + Assert.AreEqual("José", van.Ponente.Nombre); + Assert.AreEqual("TDD & Ejemplos", van.Titulo); + Assert.AreEqual(new DateTime(2010, 04, 17).ToUniversalTime(), van.FechaInicio); + Assert.AreEqual(fechaTermino, van.FechaTermino); + + var ponente1 = _personaRepository.GetByNombre("Carlos Blé"); + Assert.IsNotNull(ponente1); + + var ponente2 = _personaRepository.GetByNombre("José"); + Assert.IsNotNull(ponente2); + + Assert.AreEqual(1, van.Tracks.Where(t => t.Accion == Accion.Proponer).Count()); + Assert.AreEqual(1, van.Tracks.Where(t => t.Accion == Accion.Modificar).Count()); + } + } + + [Test] + public void Delete() + { + Guid eventoId = CreateEvento(); + + using (_requestEmulator.Invoke()) + { + Evento van = _eventoRepository.Get(eventoId); + Assert.IsNotNull(van); + + _eventoRepository.Delete(van); + } + + using (_requestEmulator.Invoke()) + { + Evento van = _eventoRepository.Get(eventoId); + + Assert.IsNull(van); + + var ponente = _personaRepository.GetByNombre("Carlos Blé"); + + Assert.IsNotNull(ponente); + } + } + + [Test] + public void Workflow() + { + Guid eventoId = CreateEvento(); + + using (_requestEmulator.Invoke()) + { + Evento evento = _eventoRepository.Get(eventoId); + Assert.AreEqual(EventoPropuestoState.GetInstance(), evento.Estado); + + evento.Agendar(evento.Ponente, evento.FechaInicio, evento.FechaTermino, null); + } + + using (_requestEmulator.Invoke()) + { + Evento evento = _eventoRepository.Get(eventoId); + Assert.AreEqual(EventoAgendadoState.GetInstance(), evento.Estado); + + evento.Confirmar(); + } + + using (_requestEmulator.Invoke()) + { + Evento evento = _eventoRepository.Get(eventoId); + Assert.AreEqual(EventoConfirmadoState.GetInstance(), evento.Estado); + + evento.Publicar(1, null, new TimeSpan(0, 0, 0)); + } + + using (_requestEmulator.Invoke()) + { + Evento evento = _eventoRepository.Get(eventoId); + Assert.AreEqual(EventoPublicadoState.GetInstance(), evento.Estado); + } + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/EventoCrudMemory.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,18 @@ +using Agendas.Repositories.Tests.Infraestructure; +using AltNetHispano.Agendas.Repositories.Memory; +using NUnit.Framework; + +namespace Agendas.Repositories.Tests +{ + [TestFixture] + public class EventoCrudMemory : EventoCrud<MemoryInfraestrutureFactory> + { + [SetUp] + public void BorrarRepositorios() + { + EventoRepository.Clear(); + PersonaRepository.Clear(); + } + + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/EventoCrudNh.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,15 @@ +using Agendas.Repositories.Tests.Infraestructure; +using NUnit.Framework; + +namespace Agendas.Repositories.Tests +{ + [TestFixture] + public class EventoCrudNh : EventoCrud<NhInfraestrutureFactory> + { + [SetUp] + public void BorrarRepositorios() + { + NhHelperTest.CleanDb(); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/Infraestructure/IInfraestrutureFactory.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,12 @@ +using System; +using AltNetHispano.Agendas.Domain.Repositories; + +namespace Agendas.Repositories.Tests.Infraestructure +{ + public interface IInfraestrutureFactory + { + IEventoRepository GetEventoRepository(); + IPersonaRepository GetPonenteRepository(); + Func<IDisposable> GetRequestEmulator(); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/Infraestructure/MemoryInfraestrutureFactory.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,25 @@ +using System; +using AltNetHispano.Agendas.Domain.Repositories; +using AltNetHispano.Agendas.Repositories.Memory; +using Moq; + +namespace Agendas.Repositories.Tests.Infraestructure +{ + public class MemoryInfraestrutureFactory : IInfraestrutureFactory + { + public IEventoRepository GetEventoRepository() + { + return new EventoRepository(); + } + + public IPersonaRepository GetPonenteRepository() + { + return new PersonaRepository(); + } + + public Func<IDisposable> GetRequestEmulator() + { + return () => new Mock<IDisposable>().Object; + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/Infraestructure/NhHelperTest.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,16 @@ +using Agendas.NHibernate; + +namespace Agendas.Repositories.Tests.Infraestructure +{ + public static class NhHelperTest + { + public static void CleanDb() + { + var sf = NhHelper.GetSessionFactory(); + + var session = sf.OpenStatelessSession(); + session.CreateSQLQuery("DELETE FROM Evento").ExecuteUpdate(); + session.CreateSQLQuery("DELETE FROM Persona").ExecuteUpdate(); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/Infraestructure/NhInfraestrutureFactory.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,32 @@ +using System; +using Agendas.NHibernate; +using AltNetHispano.Agendas.Domain.Repositories; +using AltNetHispano.Agendas.Repositories.NHibernate; +using NHibernate; + +namespace Agendas.Repositories.Tests.Infraestructure +{ + public class NhInfraestrutureFactory:IInfraestrutureFactory + { + private readonly ISessionFactory _sessionFactory; + + public NhInfraestrutureFactory() + { + _sessionFactory = NhHelper.GetSessionFactory(); + } + public IEventoRepository GetEventoRepository() + { + return new EventoRepository(_sessionFactory); + } + + public IPersonaRepository GetPonenteRepository() + { + return new PersonaRepository(_sessionFactory); + } + + public Func<IDisposable> GetRequestEmulator() + { + return () => new RequestEmulator(_sessionFactory); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/Infraestructure/RequestEmulator.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,23 @@ +using System; +using NHibernate; +using NHibernate.Context; + +namespace Agendas.Repositories.Tests.Infraestructure +{ + public class RequestEmulator : IDisposable + { + private readonly ISession _session; + + public RequestEmulator(ISessionFactory sessionFactory) + { + _session = sessionFactory.OpenSession(); + CurrentSessionContext.Bind(_session); + } + + public void Dispose() + { + _session.Flush(); + _session.Close(); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/PatrocinadorCrud.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,84 @@ +namespace Agendas.Repositories.Tests +{ + //public class PatrocinadorCrud + //{ + // private readonly IPatrocinadorRepository _patrocinadorRepository; + // private readonly Func<IDisposable> _requestEmulator; + // private byte[] _logo; + + // public PatrocinadorCrud(Func<IPatrocinadorRepository> createPatrocinadorRepository, Func<IDisposable> requestEmulator) + // { + // _patrocinadorRepository = createPatrocinadorRepository.Invoke(); + // _requestEmulator = requestEmulator; + // } + + // public Guid Create() + // { + // using (_requestEmulator.Invoke()) + // { + // var patrocinador = new Patrocinador("APRESS"); + + // patrocinador.LoadLogo("images/apress.gif"); + // _logo = patrocinador.Logo; + + // _patrocinadorRepository.Save(patrocinador); + // return patrocinador.Id; + // } + // } + + // public void Read() + // { + // Guid patrocinadorId = Create(); + + // using (_requestEmulator.Invoke()) + // { + // var patrocinador = _patrocinadorRepository.Get(patrocinadorId); + + // Assert.IsNotNull(patrocinador); + // Assert.AreEqual("APRESS", patrocinador.Nombre); + // Assert.IsNotNull(patrocinador.Logo); + // Assert.AreEqual(_logo, patrocinador.Logo); + // } + // } + + // public void Update() + // { + // Guid patrocinadorId = Create(); + + // using (_requestEmulator.Invoke()) + // { + // var patrocinador = _patrocinadorRepository.Get(patrocinadorId); + // Assert.IsNotNull(patrocinador); + + // patrocinador.Nombre = "Apress"; + // } + + // using (_requestEmulator.Invoke()) + // { + // var patrocinador = _patrocinadorRepository.Get(patrocinadorId); + + // Assert.IsNotNull(patrocinador); + // Assert.AreEqual("Apress", patrocinador.Nombre); + // } + // } + + // public void Delete() + // { + // Guid patrocinadorId = Create(); + + // using (_requestEmulator.Invoke()) + // { + // var patrocinador = _patrocinadorRepository.Get(patrocinadorId); + // Assert.IsNotNull(patrocinador); + + // _patrocinadorRepository.Delete(patrocinador); + // } + + // using (_requestEmulator.Invoke()) + // { + // var patrocinador = _patrocinadorRepository.Get(patrocinadorId); + // Assert.IsNull(patrocinador); + // } + // } + //} +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/PatrocinadorCrudMemoryTests.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,57 @@ +namespace Agendas.Repositories.Tests +{ + //[TestFixture] + //public class PatrocinadorCrudMemoryTests + //{ + // private PatrocinadorCrud _eventoCrud; + + // #region SetUp + + // [SetUp] + // public void BorrarRepositorios() + // { + // PatrocinadorRepository.Clear(); + // } + + // [SetUp] + // public void SetearUsuario() + // { + // var seguridad = new Mock<ISeguridad>(); + // seguridad.Setup(s => s.GetUserName()).Returns("neluz"); + // IdentityContext.Init(seguridad.Object, new PersonaRepository()); + // } + + // [SetUp] + // public void CreateCrud() + // { + // _eventoCrud = new PatrocinadorCrud(() => new PatrocinadorRepository(), () => new Mock<IDisposable>().Object); + // } + + // #endregion + + // [Test] + // public void Create() + // { + // _eventoCrud.Create(); + // } + + // [Test] + // public void Read() + // { + // _eventoCrud.Read(); + // } + + // [Test] + // public void Update() + // { + // _eventoCrud.Update(); + // } + + // [Test] + // public void Delete() + // { + // _eventoCrud.Delete(); + // } + + //} +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/PatrocinadorCrudNhTests.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,58 @@ +namespace Agendas.Repositories.Tests +{ + //[TestFixture] + //public class PatrocinadorCrudNhTests + //{ + // private PatrocinadorCrud _patrocinadorCrud; + + // #region SetUp + + // [SetUp] + // public void BorrarRepositorios() + // { + // NhHelperTest.CleanDb(); + // } + + // [SetUp] + // public void SetearUsuario() + // { + // var seguridad = new Mock<ISeguridad>(); + // seguridad.Setup(s => s.GetUserName()).Returns("neluz"); + // IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory())); + // } + + // [SetUp] + // public void CreateCrud() + // { + // ISessionFactory sessionFactory = NhHelper.GetSessionFactory(); + // _patrocinadorCrud = new PatrocinadorCrud(() => new PatrocinadorRepository(sessionFactory), () => new RequestEmulator(sessionFactory)); + // } + + // #endregion + + // [Test] + // public void Create() + // { + // _patrocinadorCrud.Create(); + // } + + // [Test] + // public void Read() + // { + // _patrocinadorCrud.Read(); + // } + + // [Test] + // public void Update() + // { + // _patrocinadorCrud.Update(); + // } + + // [Test] + // public void Delete() + // { + // _patrocinadorCrud.Delete(); + // } + + //} +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/PersonaCrud.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,187 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Agendas.Repositories.Tests.Infraestructure; +using AltNetHispano.Agendas.Domain; +using AltNetHispano.Agendas.Domain.Repositories; +using AltNetHispano.Agendas.Domain.Services; +using NUnit.Framework; + +namespace Agendas.Repositories.Tests +{ + public abstract class PersonaCrud<T> where T : IInfraestrutureFactory, new() + { + private readonly IPersonaRepository _personaRepository; + private readonly Func<IDisposable> _requestEmulator; + private readonly PersonaService _personaService; + private readonly IEventoRepository _eventoRepository; + + protected PersonaCrud() + { + var infraestrutureFactory = new T(); + + _eventoRepository = infraestrutureFactory.GetEventoRepository(); + _personaRepository = infraestrutureFactory.GetPonenteRepository(); + _requestEmulator = infraestrutureFactory.GetRequestEmulator(); + + _personaService = new PersonaService(_personaRepository, _eventoRepository); + } + + [Test] + public void CreateAdministrador() + { + Guid id; + using (_requestEmulator.Invoke()) + { + var r = CreatePersona("Nelo Pauselli", "nelopauselli", "nelopauselli@gmail.com", "http://nelopauselli.blogspot.com", + null); + Assert.AreEqual("Nelo Pauselli", r.Nombre); + Assert.AreNotEqual(Guid.Empty, r.Id); + + id = r.Id; + } + + using (_requestEmulator.Invoke()) + { + var persona = _personaRepository.GetByNombre("Nelo Pauselli"); + Assert.IsNotNull(persona); + Assert.AreEqual(id, persona.Id); + } + } + + private ResultadoAdd CreatePersona(string nombre, string twitter, string mail, string blog, IEnumerable<string> roles) + { + return _personaService.Add(nombre, twitter, mail, blog, roles); + } + + [Test] + public void ReadAdministrador() + { + Guid personaId; + using (_requestEmulator.Invoke()) + { + var r = CreatePersona("Nelo Pauselli", "nelopauselli", "nelopauselli@gmail.com", "http://nelopauselli.blogspot.com", + null); + personaId = r.Id; + } + + using (_requestEmulator.Invoke()) + { + var persona = _personaRepository.Get(personaId); + + Assert.IsNotNull(persona); + Assert.AreEqual("Nelo Pauselli", persona.Nombre); + Assert.AreEqual("nelopauselli", persona.Twitter); + Assert.AreEqual("nelopauselli@gmail.com", persona.Mail); + Assert.AreEqual("http://nelopauselli.blogspot.com", persona.Blog); + + Assert.IsTrue(persona.Cuentas.Any()); + Assert.AreEqual("nelopauselli", persona.Cuentas.First().LogonName); + Assert.AreEqual(IdentityProviderEnum.Twitter, persona.Cuentas.First().IdentityProvider); + + Assert.IsTrue(persona.Roles.Any()); + Assert.IsTrue(persona.Roles.Contains(Roles.Usuario)); + Assert.IsTrue(persona.Roles.Contains(Roles.Administrador)); + } + } + + [Test] + public void CreateUsuario() + { + using (_requestEmulator.Invoke()) + { + CreatePersona("Pablo Morales", "pablomorales", "pablomorales@gmail.com", "http://pablomorales.blogspot.com", + new[] {Roles.Usuario}); + } + + using (_requestEmulator.Invoke()) + { + var persona = _personaRepository.GetByNombre("Pablo Morales"); + Assert.IsNotNull(persona); + } + } + + [Test] + public void ReadUsuario() + { + Guid personaId; + using (_requestEmulator.Invoke()) + { + var r = CreatePersona("Pablo Morales", "pablomorales", "pablomorales@gmail.com", "http://pablomorales.blogspot.com", + new[] {Roles.Usuario}); + personaId = r.Id; + } + + using (_requestEmulator.Invoke()) + { + var persona = _personaRepository.Get(personaId); + + Assert.IsNotNull(persona); + Assert.AreEqual("Pablo Morales", persona.Nombre); + Assert.AreEqual("pablomorales", persona.Twitter); + Assert.AreEqual("pablomorales@gmail.com", persona.Mail); + Assert.AreEqual("http://pablomorales.blogspot.com", persona.Blog); + + Assert.IsTrue(persona.Cuentas.Any()); + Assert.AreEqual("pablomorales", persona.Cuentas.First().LogonName); + Assert.AreEqual(IdentityProviderEnum.Twitter, persona.Cuentas.First().IdentityProvider); + + Assert.IsTrue(persona.Roles.Any()); + Assert.IsTrue(persona.Roles.Contains(Roles.Usuario)); + Assert.IsFalse(persona.Roles.Contains(Roles.Administrador)); + } + } + + [Test] + public void Update() + { + Guid personaId; + using (_requestEmulator.Invoke()) + { + var r = CreatePersona("Nelo Pauselli", "nelopauselli", "nelopauselli@gmail.com", "http://nelopauselli.blogspot.com", + null); + personaId = r.Id; + } + + using (_requestEmulator.Invoke()) + { + var persona = _personaRepository.Get(personaId); + Assert.IsNotNull(persona); + + persona.Nombre = "Nelo Mariano Pauselli"; + } + + using (_requestEmulator.Invoke()) + { + var persona = _personaRepository.Get(personaId); + + Assert.IsNotNull(persona); + Assert.AreEqual("Nelo Mariano Pauselli", persona.Nombre); + } + } + + [Test] + public void Delete() + { + Guid personaId; + using (_requestEmulator.Invoke()) + { + var r = CreatePersona("Nelo Pauselli", "nelopauselli", "nelopauselli@gmail.com", + "http://nelopauselli.blogspot.com", null); + personaId = r.Id; + } + + using (_requestEmulator.Invoke()) + { + var persona = _personaRepository.Get(personaId); + Assert.IsNotNull(persona); + _personaService.Delete(personaId); + } + using (_requestEmulator.Invoke()) + { + var persona = _personaRepository.Get(personaId); + Assert.IsNull(persona); + } + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/PersonaCrudMemoryTests.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,16 @@ +using Agendas.Repositories.Tests.Infraestructure; +using AltNetHispano.Agendas.Repositories.Memory; +using NUnit.Framework; + +namespace Agendas.Repositories.Tests +{ + [TestFixture] + public class PersonaCrudMemoryTests : PersonaCrud<MemoryInfraestrutureFactory> + { + [SetUp] + public void BorrarRepositorios() + { + PersonaRepository.Clear(); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/PersonaCrudNhTests.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,15 @@ +using Agendas.Repositories.Tests.Infraestructure; +using NUnit.Framework; + +namespace Agendas.Repositories.Tests +{ + [TestFixture] + public class PersonaCrudNhTests : PersonaCrud<NhInfraestrutureFactory> + { + [SetUp] + public void BorrarRepositorios() + { + NhHelperTest.CleanDb(); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/Properties/AssemblyInfo.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Agendas.Repositories.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Agendas.Repositories.Tests")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d96f300a-bf61-4c17-a4bd-f8d38f6f29e7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/SchemaNhTests.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,62 @@ +using System; +using System.Xml; +using System.Xml.Serialization; +using Agendas.NHibernate; +using Agendas.Repositories.Tests.Infraestructure; +using NHibernate.Cfg.MappingSchema; +using NHibernate.Tool.hbm2ddl; +using NUnit.Framework; + +namespace Agendas.Repositories.Tests +{ + [TestFixture] + public class SchemaNhTests + { + [Test] + public void ValidateSchema() + { + var cfg = NhHelper.GetConfiguration(); + + var schemaValidator = new SchemaValidator(cfg); + schemaValidator.Validate(); + } + + [Test] + public void BuildSessionFactory() + { + var cfg = NhHelper.GetConfiguration(); + + var sessionfactory = cfg.BuildSessionFactory(); + + Assert.IsNotNull(sessionfactory); + } + + [Test] + public void ShowMapping() + { + var mapping = NhHelper.GetMapping(); + + var setting = new XmlWriterSettings { Indent = true }; + + var serializer = new XmlSerializer(typeof(HbmMapping)); + + var xw = XmlWriter.Create(Console.Out, setting); + + serializer.Serialize(xw, mapping); + } + + [Test] + public void LimpiarDb() + { + NhHelperTest.CleanDb(); + + var sf = NhHelper.GetSessionFactory(); + + var session = sf.OpenSession(); + + var query = session.CreateQuery("from System.Object"); + + Assert.IsEmpty(query.List()); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/TestsHelper.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,28 @@ +using System; +using AltNetHispano.Agendas.Domain; +using AltNetHispano.Agendas.Domain.Repositories; + +namespace Agendas.Repositories.Tests +{ + public class TestsHelper + { + private readonly IPersonaRepository _repository; + + public TestsHelper(IPersonaRepository repository) + { + _repository = repository; + } + + public Guid GetOrCreatePonente(string nombre) + { + var persona = _repository.GetByNombre(nombre); + if (persona == null) + { + persona = new Persona(nombre) { Twitter = nombre.Replace(" ", string.Empty).ToLower() }; + _repository.Save(persona); + } + return persona.Id; + } + + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/Workflow.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,117 @@ +using System; +using System.Linq; +using AltNetHispano.Agendas.Domain; +using AltNetHispano.Agendas.Domain.Repositories; +using NUnit.Framework; + +namespace Agendas.Repositories.Tests +{ + internal class Workflow + { + private readonly Func<IDisposable> _requestEmulator; + private readonly Agenda _agenda; + private readonly IEventoRepository _eventoRepository; + private Guid _eventoId; + private readonly TestsHelper _testsHelper; + + public Workflow(IPublicador publicador, IEventoRepository eventoRepository, IPersonaRepository personaRepository, + Func<IDisposable> requestEmulator) + { + _requestEmulator = requestEmulator; + _eventoRepository = eventoRepository; + + _agenda = new Agenda(publicador, eventoRepository, personaRepository); + _testsHelper = new TestsHelper(personaRepository); + } + + public void Proponer() + { + using (_requestEmulator.Invoke()) + { + var resultado = _agenda.Proponer("SOLID", _testsHelper.GetOrCreatePonente("Jorge"), null, TipoEvento.Van); + Assert.IsTrue(resultado.Succeful); + } + + GetId(); + } + + + public void Agendar() + { + using (_requestEmulator.Invoke()) + { + var fechaInicio = DateTime.Today.AddDays(5).ToUniversalTime(); + var fechaTermino = fechaInicio.AddHours(2); + var resultado = _agenda.Agendar("SOLID", _testsHelper.GetOrCreatePonente("Jorge"), fechaInicio, fechaTermino, null, + TipoEvento.Van); + Assert.IsTrue(resultado.Succeful); + } + + GetId(); + } + + private void GetId() + { + using (_requestEmulator.Invoke()) + { + var evento = _eventoRepository.GetActivos().SingleOrDefault(); + Assert.IsNotNull(evento); + _eventoId = evento.Id; + } + } + + public void Confirmar() + { + using (_requestEmulator.Invoke()) + { + var resultado = _agenda.Confirmar(_eventoId); + Assert.IsTrue(resultado.Succeful); + } + } + + public void Publicar() + { + using (_requestEmulator.Invoke()) + { + var resultado = _agenda.Publicar(_eventoId, 1, "http://www.altnethispano.org/", new TimeSpan(2, 11, 0)); + Assert.IsTrue(resultado.Succeful); + } + } + + public void Cancelar() + { + using (_requestEmulator.Invoke()) + { + var resultado = _agenda.Cancelar(_eventoId); + Assert.IsTrue(resultado.Succeful); + } + } + + public void Descartar() + { + using (_requestEmulator.Invoke()) + { + var resultado = _agenda.Descartar(_eventoId); + Assert.IsTrue(resultado.Succeful); + } + } + + public void ReProponer() + { + using (_requestEmulator.Invoke()) + { + var resultado = _agenda.ReProponer(_eventoId); + Assert.IsTrue(resultado.Succeful); + } + } + + public void ReAgendar() + { + using (_requestEmulator.Invoke()) + { + var resultado = _agenda.ReAgendar(_eventoId); + Assert.IsTrue(resultado.Succeful); + } + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/WorkflowMemoryTests.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,18 @@ +using Agendas.Repositories.Tests.Infraestructure; +using AltNetHispano.Agendas.Repositories.Memory; +using NUnit.Framework; + +namespace Agendas.Repositories.Tests +{ + [TestFixture] + public class WorkflowMemoryTests : WorkflowTests<MemoryInfraestrutureFactory> + { + [SetUp] + public void BorrarRepositorios() + { + EventoRepository.Clear(); + PersonaRepository.Clear(); + } + + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/WorkflowNhTests.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,15 @@ +using Agendas.Repositories.Tests.Infraestructure; +using NUnit.Framework; + +namespace Agendas.Repositories.Tests +{ + [TestFixture] + public class WorkflowNhTests : WorkflowTests<NhInfraestrutureFactory> + { + [SetUp] + public void BorrarRepositorios() + { + NhHelperTest.CleanDb(); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/WorkflowTests.cs Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,206 @@ +using System; +using System.Collections.Generic; +using Agendas.Repositories.Tests.Infraestructure; +using AltNetHispano.Agendas.Domain; +using AltNetHispano.Agendas.Domain.Repositories; +using Moq; +using NUnit.Framework; + +namespace Agendas.Repositories.Tests +{ + public abstract class WorkflowTests<T> where T : IInfraestrutureFactory, new() + { + private readonly IPersonaRepository _personaRepository; + private readonly IEventoRepository _eventoRepository; + private readonly Func<IDisposable> _requestEmulator; + + protected WorkflowTests() + { + var infraestrutureFactory = new T(); + + _eventoRepository = infraestrutureFactory.GetEventoRepository(); + _personaRepository = infraestrutureFactory.GetPonenteRepository(); + _requestEmulator = infraestrutureFactory.GetRequestEmulator(); + } + + [SetUp] + public void SetearUsuario() + { + var seguridad = new Mock<ISeguridad>(); + seguridad.Setup(s => s.GetUserName()).Returns("neluz"); + IdentityContext.Init(seguridad.Object, _personaRepository); + } + + [Test] + public void Proponer() + { + var publicador = new Mock<IPublicador>(); + var workflow = new Workflow(publicador.Object, _eventoRepository, _personaRepository, _requestEmulator); + + workflow.Proponer(); + publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Once()); + } + + [Test] + public void Proponer_y_agendar() + { + var publicador = new Mock<IPublicador>(); + var workflow = new Workflow(publicador.Object, _eventoRepository, _personaRepository, _requestEmulator); + + workflow.Proponer(); + + workflow.Agendar(); + + publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(2)); + } + [Test] + public void Proponer_agendar_y_cancelar() + { + var publicador = new Mock<IPublicador>(); + var workflow = new Workflow(publicador.Object, _eventoRepository, _personaRepository, _requestEmulator); + + 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() + { + var publicador = new Mock<IPublicador>(); + var workflow = new Workflow(publicador.Object, _eventoRepository, _personaRepository, _requestEmulator); + + 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() + { + var publicador = new Mock<IPublicador>(); + var workflow = new Workflow(publicador.Object, _eventoRepository, _personaRepository, _requestEmulator); + + 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() + { + var publicador = new Mock<IPublicador>(); + var workflow = new Workflow(publicador.Object, _eventoRepository, _personaRepository, _requestEmulator); + + 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() + { + var publicador = new Mock<IPublicador>(); + var workflow = new Workflow(publicador.Object, _eventoRepository, _personaRepository, _requestEmulator); + + 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() + { + var publicador = new Mock<IPublicador>(); + var workflow = new Workflow(publicador.Object, _eventoRepository, _personaRepository, _requestEmulator); + + workflow.Proponer(); + + workflow.Descartar(); + publicador.Verify(p => p.Publicar(It.IsAny<IEnumerable<Track>>()), Times.Exactly(2)); + } + + [Test] + public void Proponer_agendar_cancelar_y_descartar() + { + var publicador = new Mock<IPublicador>(); + var workflow = new Workflow(publicador.Object, _eventoRepository, _personaRepository, _requestEmulator); + + 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() + { + var publicador = new Mock<IPublicador>(); + var workflow = new Workflow(publicador.Object, _eventoRepository, _personaRepository, _requestEmulator); + + 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() + { + var publicador = new Mock<IPublicador>(); + var workflow = new Workflow(publicador.Object, _eventoRepository, _personaRepository, _requestEmulator); + + 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/hibernate.cfg.xml Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" > + <session-factory> + <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property> + <property name="connection.connection_string_name">AltNetHispano</property> + <property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property> + + <property name="current_session_context_class">NHibernate.Context.ThreadStaticSessionContext, NHibernate</property> + <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property> + </session-factory> +</hibernate-configuration> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.Tests/packages.config Mon Sep 19 18:18:17 2011 -0300 @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="NUnit" version="2.5.10.11092" /> + <package id="Moq" version="4.0.10827" /> + <package id="Iesi.Collections" version="3.1.0.4000" /> + <package id="NHibernate" version="3.1.0.4000" /> +</packages> \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Agendas.Tests.csproj Tue Sep 13 09:01:58 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Tests/Agendas.Tests.csproj Mon Sep 19 18:18:17 2011 -0300 @@ -31,27 +31,9 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="Castle.Core"> - <HintPath>..\packages\Castle.Core.2.5.2\lib\NET35\Castle.Core.dll</HintPath> - </Reference> - <Reference Include="ConfOrm, Version=1.0.1.5, Culture=neutral, PublicKeyToken=ed8affdf01cbe4cf, processorArchitecture=MSIL"> - <HintPath>..\packages\ConfOrm.1.0.1.5\lib\Net35\ConfOrm.dll</HintPath> - </Reference> - <Reference Include="ConfOrm.Shop"> - <HintPath>..\packages\ConfOrm.1.0.1.5\lib\Net35\ConfOrm.Shop.dll</HintPath> - </Reference> - <Reference Include="Iesi.Collections"> - <HintPath>..\packages\Iesi.Collections.3.1.0.4000\lib\Net35\Iesi.Collections.dll</HintPath> - </Reference> <Reference Include="Moq"> <HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath> </Reference> - <Reference Include="NHibernate, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL"> - <HintPath>..\packages\NHibernate.3.1.0.4000\lib\Net35\NHibernate.dll</HintPath> - </Reference> - <Reference Include="NHibernate.ByteCode.Castle"> - <HintPath>..\packages\NHibernate.Castle.3.1.0.4000\lib\Net35\NHibernate.ByteCode.Castle.dll</HintPath> - </Reference> <Reference Include="nunit.framework"> <HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath> </Reference> @@ -74,18 +56,6 @@ <ItemGroup> <Compile Include="Blog\PostWriterWebServiceAdapterTests.cs" /> <Compile Include="Blog\PublicadorTests.cs" /> - <Compile Include="Cruds\EventoCrud.cs" /> - <Compile Include="Cruds\EventoCrudNhTests.cs" /> - <Compile Include="Cruds\IPersonaCrudTest.cs" /> - <Compile Include="Cruds\NhHelperTest.cs" /> - <Compile Include="Cruds\PatrocinadorCrud.cs" /> - <Compile Include="Cruds\PatrocinadorCrudMemoryTests.cs" /> - <Compile Include="Cruds\PatrocinadorCrudNhTests.cs" /> - <Compile Include="Cruds\PersonaCrud.cs" /> - <Compile Include="Cruds\PersonaCrudMemoryTests.cs" /> - <Compile Include="Cruds\PersonaCrudNhTests.cs" /> - <Compile Include="Cruds\RequestEmulator.cs" /> - <Compile Include="Cruds\SchemaNhTests.cs" /> <Compile Include="DateTimeFormattingTests.cs" /> <Compile Include="EventoStateTests.cs" /> <Compile Include="Eventos_y_patrocinadores_tests.cs" /> @@ -93,15 +63,11 @@ <Compile Include="PersonaServiceTests.cs" /> <Compile Include="PonentesTests.cs" /> <Compile Include="PropuestasTests.cs" /> - <Compile Include="Cruds\EventoCrudMemoryTests.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="AgendarTests.cs" /> <Compile Include="TestBase.cs" /> <Compile Include="TestsHelper.cs" /> <Compile Include="TrackTests.cs" /> - <Compile Include="Workflows\Workflow.cs" /> - <Compile Include="Workflows\WorkflowNhTests.cs" /> - <Compile Include="Workflows\WorkflowMemoryTests.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\Agendas.Blog\Agendas.Blog.csproj"> @@ -116,18 +82,10 @@ <Project>{45804F1F-EB72-4F82-A227-088CAD9B785D}</Project> <Name>Agendas.Google</Name> </ProjectReference> - <ProjectReference Include="..\Agendas.NHibernate\Agendas.NHibernate.csproj"> - <Project>{9519A43A-9D5E-4BFD-9F88-AFFC53C9973A}</Project> - <Name>Agendas.NHibernate</Name> - </ProjectReference> <ProjectReference Include="..\Agendas.Repositories.Memory\Agendas.Repositories.Memory.csproj"> <Project>{28C5EBFB-EE69-4765-A880-D4DE0BC89F48}</Project> <Name>Agendas.Repositories.Memory</Name> </ProjectReference> - <ProjectReference Include="..\Agendas.Repositories.NHibernate\Agendas.Repositories.NHibernate.csproj"> - <Project>{0973DF44-3B90-4D2A-B579-C64C93B6C853}</Project> - <Name>Agendas.Repositories.NHibernate</Name> - </ProjectReference> </ItemGroup> <ItemGroup> <None Include="App.config">
--- a/Agendas/trunk/src/Agendas.Tests/App.config Tue Sep 13 09:01:58 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Tests/App.config Mon Sep 19 18:18:17 2011 -0300 @@ -4,10 +4,6 @@ <section name="publicadores" type="AltNetHispano.Agendas.Configurations.PublicadoresConfigurationSection, AltNetHispano.Agendas.Configurations, Version=1.0.0.0, Culture=neutral" /> </configSections> - <connectionStrings> - <add name="AltNetHispano" connectionString="Data Source=.\sqlexpress;Initial Catalog=AltNetHispano_Test;Integrated Security=SSPI"/> - </connectionStrings> - <publicadores> <blog enabled="true" /> </publicadores>
--- a/Agendas/trunk/src/Agendas.Tests/Cruds/EventoCrud.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -using System; -using System.Linq; -using AltNetHispano.Agendas.Domain; -using AltNetHispano.Agendas.Domain.Repositories; -using NUnit.Framework; - -namespace AltNetHispano.Agendas.Tests.Cruds -{ - public class EventoCrud - { - private readonly IEventoRepository _eventoRepository; - private readonly Func<IDisposable> _requestEmulator; - private readonly IPersonaRepository _personaRepository; - - public EventoCrud(Func<IEventoRepository> createEventoRepository, Func<IPersonaRepository> createPonenteRepository, Func<IDisposable> requestEmulator) - { - _eventoRepository = createEventoRepository.Invoke(); - _personaRepository = createPonenteRepository.Invoke(); - - _requestEmulator = requestEmulator; - } - - public Guid Create() - { - using (_requestEmulator.Invoke()) - { - var ponente = new Persona("Carlos Blé") {Twitter = "carlosble"}; - _personaRepository.Save(ponente); - - var usuario = new Persona("Nelo") {Twitter = "nelopauselli"}; - _personaRepository.Save(usuario); - - var evento = Evento.Proponer("TDD - Diseño Basado en Ejemplos", ponente, string.Empty, TipoEvento.Van); - evento.Tracks.First().LogAdd(new TrackLog(TrackLogPropietario.Twitter, "Mensaje", usuario, true)); - - _eventoRepository.Save(evento); - - return evento.Id; - } - } - - public void Read() - { - Guid eventoId = Create(); - - using (_requestEmulator.Invoke()) - { - Evento van = _eventoRepository.Get(eventoId); - - Assert.IsNotNull(van); - Assert.IsNotNull(van.Ponente); - Assert.AreEqual("Carlos Blé", van.Ponente.Nombre); - - var track1 = van.Tracks.Where(t => t.Accion == Accion.Proponer).FirstOrDefault(); - Assert.IsNotNull(track1); - Assert.AreEqual(van, track1.Evento); - - Assert.AreEqual("TDD - Diseño Basado en Ejemplos", van.Titulo); - } - } - - public void Update() - { - Guid eventoId = Create(); - var fechaInicio = new DateTime(2010, 04, 17).ToUniversalTime(); - var fechaTermino = fechaInicio.AddHours(2); - - using (_requestEmulator.Invoke()) - { - Evento van = _eventoRepository.Get(eventoId); - - Assert.IsNotNull(van); - - van.CambiarTitulo("TDD & Ejemplos"); - - var otroPonente = new Persona("José"); - _personaRepository.Save(otroPonente); - - van.Actualizar(otroPonente, fechaInicio, fechaTermino, null); - - _eventoRepository.Update(van); - } - - using (_requestEmulator.Invoke()) - { - Evento van = _eventoRepository.Get(eventoId); - - Assert.IsNotNull(van); - Assert.IsNotNull(van.Ponente); - Assert.AreEqual("José", van.Ponente.Nombre); - Assert.AreEqual("TDD & Ejemplos", van.Titulo); - Assert.AreEqual(new DateTime(2010, 04, 17).ToUniversalTime(), van.FechaInicio); - Assert.AreEqual(fechaTermino, van.FechaTermino); - - var ponente1 = _personaRepository.GetByNombre("Carlos Blé"); - Assert.IsNotNull(ponente1); - - var ponente2 = _personaRepository.GetByNombre("José"); - Assert.IsNotNull(ponente2); - - Assert.AreEqual(1, van.Tracks.Where(t => t.Accion == Accion.Proponer).Count()); - Assert.AreEqual(1, van.Tracks.Where(t => t.Accion == Accion.Modificar).Count()); - } - } - - public void Delete() - { - Guid eventoId = Create(); - - using (_requestEmulator.Invoke()) - { - Evento van = _eventoRepository.Get(eventoId); - Assert.IsNotNull(van); - - _eventoRepository.Delete(van); - } - - using (_requestEmulator.Invoke()) - { - Evento van = _eventoRepository.Get(eventoId); - - Assert.IsNull(van); - - var ponente = _personaRepository.GetByNombre("Carlos Blé"); - - Assert.IsNotNull(ponente); - } - } - - public void Workflow() - { - Guid eventoId = Create(); - - using (_requestEmulator.Invoke()) - { - Evento evento = _eventoRepository.Get(eventoId); - Assert.AreEqual(EventoPropuestoState.GetInstance(), evento.Estado); - - evento.Agendar(evento.Ponente, evento.FechaInicio, evento.FechaTermino, null); - } - - using (_requestEmulator.Invoke()) - { - Evento evento = _eventoRepository.Get(eventoId); - Assert.AreEqual(EventoAgendadoState.GetInstance(), evento.Estado); - - evento.Confirmar(); - } - - using (_requestEmulator.Invoke()) - { - Evento evento = _eventoRepository.Get(eventoId); - Assert.AreEqual(EventoConfirmadoState.GetInstance(), evento.Estado); - - evento.Publicar(1, null, new TimeSpan(0, 0, 0)); - } - - using (_requestEmulator.Invoke()) - { - Evento evento = _eventoRepository.Get(eventoId); - Assert.AreEqual(EventoPublicadoState.GetInstance(), evento.Estado); - } - } - } -} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Cruds/EventoCrudMemoryTests.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -using System; -using AltNetHispano.Agendas.Domain; -using AltNetHispano.Agendas.Repositories.Memory; -using Moq; -using NUnit.Framework; - -namespace AltNetHispano.Agendas.Tests.Cruds -{ - [TestFixture] - public class EventoCrudMemoryTests - { - private EventoCrud _eventoCrud; - - #region SetUp - - [SetUp] - public void BorrarRepositorios() - { - EventoRepository.Clear(); - PersonaRepository.Clear(); - } - - [SetUp] - public void SetearUsuario() - { - var seguridad = new Mock<ISeguridad>(); - seguridad.Setup(s => s.GetUserName()).Returns("neluz"); - IdentityContext.Init(seguridad.Object, new PersonaRepository()); - } - - [SetUp] - public void CreateCrud() - { - _eventoCrud = new EventoCrud(() => new EventoRepository(), ()=>new PersonaRepository(), () => new Mock<IDisposable>().Object); - } - - #endregion - - [Test] - public void Create() - { - _eventoCrud.Create(); - } - - [Test] - public void Read() - { - _eventoCrud.Read(); - } - - [Test] - public void Update() - { - _eventoCrud.Update(); - } - - [Test] - public void Delete() - { - _eventoCrud.Delete(); - } - - [Test] - public void Workflow() - { - _eventoCrud.Workflow(); - } - } -} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Cruds/EventoCrudNhTests.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -using Agendas.NHibernate; -using AltNetHispano.Agendas.Domain; -using AltNetHispano.Agendas.Repositories.NHibernate; -using Moq; -using NHibernate; -using NUnit.Framework; - -namespace AltNetHispano.Agendas.Tests.Cruds -{ - [TestFixture] - public class EventoCrudNhTests - { - private EventoCrud _eventoCrud; - - #region SetUp - - [SetUp] - public void BorrarRepositorios() - { - NhHelperTest.CleanDb(); - } - - [SetUp] - public void SetearUsuario() - { - var seguridad = new Mock<ISeguridad>(); - seguridad.Setup(s => s.GetUserName()).Returns("neluz"); - IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory())); - } - - [SetUp] - public void CreateCrud() - { - ISessionFactory sessionFactory=NhHelper.GetSessionFactory(); - _eventoCrud = new EventoCrud(() => new EventoRepository(sessionFactory), () => new PersonaRepository(sessionFactory), - () => new RequestEmulator(sessionFactory)); - } - - #endregion - - [Test] - public void Create() - { - _eventoCrud.Create(); - } - - [Test] - public void Read() - { - _eventoCrud.Read(); - } - - [Test] - public void Update() - { - _eventoCrud.Update(); - } - - [Test] - public void Delete() - { - _eventoCrud.Delete(); - } - - [Test] - public void Workflow() - { - _eventoCrud.Workflow(); - } - - } -} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Cruds/IPersonaCrudTest.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -using NUnit.Framework; - -namespace AltNetHispano.Agendas.Tests.Cruds -{ - public interface IPersonaCrudTest - { - [Test] - void CreateAdministrador(); - - [Test] - void ReadAdministrador(); - - [Test] - void CreateUsuario(); - - [Test] - void ReadUsuario(); - - [Test] - void Update(); - } -} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Cruds/NhHelperTest.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -using Agendas.NHibernate; - -namespace AltNetHispano.Agendas.Tests.Cruds -{ - public static class NhHelperTest - { - public static void CleanDb() - { - var sf = NhHelper.GetSessionFactory(); - - var session = sf.OpenStatelessSession(); - session.CreateSQLQuery("DELETE FROM Evento").ExecuteUpdate(); - session.CreateSQLQuery("DELETE FROM Persona").ExecuteUpdate(); - } - } -} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Cruds/PatrocinadorCrud.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -using System; -using AltNetHispano.Agendas.Domain; -using AltNetHispano.Agendas.Domain.Repositories; -using NUnit.Framework; - -namespace AltNetHispano.Agendas.Tests.Cruds -{ - //public class PatrocinadorCrud - //{ - // private readonly IPatrocinadorRepository _patrocinadorRepository; - // private readonly Func<IDisposable> _requestEmulator; - // private byte[] _logo; - - // public PatrocinadorCrud(Func<IPatrocinadorRepository> createPatrocinadorRepository, Func<IDisposable> requestEmulator) - // { - // _patrocinadorRepository = createPatrocinadorRepository.Invoke(); - // _requestEmulator = requestEmulator; - // } - - // public Guid Create() - // { - // using (_requestEmulator.Invoke()) - // { - // var patrocinador = new Patrocinador("APRESS"); - - // patrocinador.LoadLogo("images/apress.gif"); - // _logo = patrocinador.Logo; - - // _patrocinadorRepository.Save(patrocinador); - // return patrocinador.Id; - // } - // } - - // public void Read() - // { - // Guid patrocinadorId = Create(); - - // using (_requestEmulator.Invoke()) - // { - // var patrocinador = _patrocinadorRepository.Get(patrocinadorId); - - // Assert.IsNotNull(patrocinador); - // Assert.AreEqual("APRESS", patrocinador.Nombre); - // Assert.IsNotNull(patrocinador.Logo); - // Assert.AreEqual(_logo, patrocinador.Logo); - // } - // } - - // public void Update() - // { - // Guid patrocinadorId = Create(); - - // using (_requestEmulator.Invoke()) - // { - // var patrocinador = _patrocinadorRepository.Get(patrocinadorId); - // Assert.IsNotNull(patrocinador); - - // patrocinador.Nombre = "Apress"; - // } - - // using (_requestEmulator.Invoke()) - // { - // var patrocinador = _patrocinadorRepository.Get(patrocinadorId); - - // Assert.IsNotNull(patrocinador); - // Assert.AreEqual("Apress", patrocinador.Nombre); - // } - // } - - // public void Delete() - // { - // Guid patrocinadorId = Create(); - - // using (_requestEmulator.Invoke()) - // { - // var patrocinador = _patrocinadorRepository.Get(patrocinadorId); - // Assert.IsNotNull(patrocinador); - - // _patrocinadorRepository.Delete(patrocinador); - // } - - // using (_requestEmulator.Invoke()) - // { - // var patrocinador = _patrocinadorRepository.Get(patrocinadorId); - // Assert.IsNull(patrocinador); - // } - // } - //} -} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Cruds/PatrocinadorCrudMemoryTests.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -using System; -using AltNetHispano.Agendas.Domain; -using AltNetHispano.Agendas.Repositories.Memory; -using Moq; -using NUnit.Framework; - -namespace AltNetHispano.Agendas.Tests.Cruds -{ - //[TestFixture] - //public class PatrocinadorCrudMemoryTests - //{ - // private PatrocinadorCrud _eventoCrud; - - // #region SetUp - - // [SetUp] - // public void BorrarRepositorios() - // { - // PatrocinadorRepository.Clear(); - // } - - // [SetUp] - // public void SetearUsuario() - // { - // var seguridad = new Mock<ISeguridad>(); - // seguridad.Setup(s => s.GetUserName()).Returns("neluz"); - // IdentityContext.Init(seguridad.Object, new PersonaRepository()); - // } - - // [SetUp] - // public void CreateCrud() - // { - // _eventoCrud = new PatrocinadorCrud(() => new PatrocinadorRepository(), () => new Mock<IDisposable>().Object); - // } - - // #endregion - - // [Test] - // public void Create() - // { - // _eventoCrud.Create(); - // } - - // [Test] - // public void Read() - // { - // _eventoCrud.Read(); - // } - - // [Test] - // public void Update() - // { - // _eventoCrud.Update(); - // } - - // [Test] - // public void Delete() - // { - // _eventoCrud.Delete(); - // } - - //} -} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Cruds/PatrocinadorCrudNhTests.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -using Agendas.NHibernate; -using AltNetHispano.Agendas.Domain; -using AltNetHispano.Agendas.Repositories.NHibernate; -using Moq; -using NHibernate; -using NUnit.Framework; - -namespace AltNetHispano.Agendas.Tests.Cruds -{ - //[TestFixture] - //public class PatrocinadorCrudNhTests - //{ - // private PatrocinadorCrud _patrocinadorCrud; - - // #region SetUp - - // [SetUp] - // public void BorrarRepositorios() - // { - // NhHelperTest.CleanDb(); - // } - - // [SetUp] - // public void SetearUsuario() - // { - // var seguridad = new Mock<ISeguridad>(); - // seguridad.Setup(s => s.GetUserName()).Returns("neluz"); - // IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory())); - // } - - // [SetUp] - // public void CreateCrud() - // { - // ISessionFactory sessionFactory = NhHelper.GetSessionFactory(); - // _patrocinadorCrud = new PatrocinadorCrud(() => new PatrocinadorRepository(sessionFactory), () => new RequestEmulator(sessionFactory)); - // } - - // #endregion - - // [Test] - // public void Create() - // { - // _patrocinadorCrud.Create(); - // } - - // [Test] - // public void Read() - // { - // _patrocinadorCrud.Read(); - // } - - // [Test] - // public void Update() - // { - // _patrocinadorCrud.Update(); - // } - - // [Test] - // public void Delete() - // { - // _patrocinadorCrud.Delete(); - // } - - //} -} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Cruds/PersonaCrud.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -using System; -using System.Linq; -using AltNetHispano.Agendas.Domain; -using AltNetHispano.Agendas.Domain.Repositories; -using AltNetHispano.Agendas.Domain.Services; -using NUnit.Framework; - -namespace AltNetHispano.Agendas.Tests.Cruds -{ - public class PersonaCrud - { - private readonly IPersonaRepository _personaRepository; - private readonly Func<IDisposable> _requestEmulator; - private readonly PersonaService _personaService; - private readonly IEventoRepository _eventoRepository; - - public PersonaCrud(Func<IPersonaRepository> createpersonaRepository, Func<IDisposable> requestEmulator, Func<IEventoRepository> createEventoRespository) - { - _personaRepository = createpersonaRepository.Invoke(); - _eventoRepository = createEventoRespository.Invoke(); - _personaService = new PersonaService(_personaRepository, _eventoRepository); - _requestEmulator = requestEmulator; - } - - public Guid CreateAdministrador() - { - Guid id; - using (_requestEmulator.Invoke()) - { - var r = _personaService.Add("Nelo Pauselli", "nelopauselli", "nelopauselli@gmail.com", "http://nelopauselli.blogspot.com", null); - Assert.AreEqual("Nelo Pauselli", r.Nombre); - Assert.AreNotEqual(Guid.Empty, r.Id); - - id = r.Id; - } - - using (_requestEmulator.Invoke()) - { - var persona = _personaRepository.GetByNombre("Nelo Pauselli"); - Assert.IsNotNull(persona); - Assert.AreEqual(id, persona.Id); - return persona.Id; - } - } - - public void ReadAdministrador() - { - Guid personaId = CreateAdministrador(); - - using (_requestEmulator.Invoke()) - { - var persona = _personaRepository.Get(personaId); - - Assert.IsNotNull(persona); - Assert.AreEqual("Nelo Pauselli", persona.Nombre); - Assert.AreEqual("nelopauselli", persona.Twitter); - Assert.AreEqual("nelopauselli@gmail.com", persona.Mail); - Assert.AreEqual("http://nelopauselli.blogspot.com", persona.Blog); - - Assert.IsTrue(persona.Cuentas.Any()); - Assert.AreEqual("nelopauselli", persona.Cuentas.First().LogonName); - Assert.AreEqual(IdentityProviderEnum.Twitter, persona.Cuentas.First().IdentityProvider); - - Assert.IsTrue(persona.Roles.Any()); - Assert.IsTrue(persona.Roles.Contains(Roles.Usuario)); - Assert.IsTrue(persona.Roles.Contains(Roles.Administrador)); - } - } - - public Guid CreateUsuario() - { - using (_requestEmulator.Invoke()) - { - _personaService.Add("Pablo Morales", "pablomorales", "pablomorales@gmail.com", "http://pablomorales.blogspot.com", new[]{Roles.Usuario}); - } - - using (_requestEmulator.Invoke()) - { - var persona = _personaRepository.GetByNombre("Pablo Morales"); - Assert.IsNotNull(persona); - return persona.Id; - } - } - - public void ReadUsuario() - { - Guid personaId = CreateUsuario(); - - using (_requestEmulator.Invoke()) - { - var persona = _personaRepository.Get(personaId); - - Assert.IsNotNull(persona); - Assert.AreEqual("Pablo Morales", persona.Nombre); - Assert.AreEqual("pablomorales", persona.Twitter); - Assert.AreEqual("pablomorales@gmail.com", persona.Mail); - Assert.AreEqual("http://pablomorales.blogspot.com", persona.Blog); - - Assert.IsTrue(persona.Cuentas.Any()); - Assert.AreEqual("pablomorales", persona.Cuentas.First().LogonName); - Assert.AreEqual(IdentityProviderEnum.Twitter, persona.Cuentas.First().IdentityProvider); - - Assert.IsTrue(persona.Roles.Any()); - Assert.IsTrue(persona.Roles.Contains(Roles.Usuario)); - Assert.IsFalse(persona.Roles.Contains(Roles.Administrador)); - } - } - - public void Update() - { - Guid personaId = CreateAdministrador(); - - using (_requestEmulator.Invoke()) - { - var persona = _personaRepository.Get(personaId); - Assert.IsNotNull(persona); - - persona.Nombre = "Nelo Mariano Pauselli"; - } - - using (_requestEmulator.Invoke()) - { - var persona = _personaRepository.Get(personaId); - - Assert.IsNotNull(persona); - Assert.AreEqual("Nelo Mariano Pauselli", persona.Nombre); - } - } - public void Delete() - { - var personaId = CreateUsuario(); - using (_requestEmulator.Invoke()) - { - var persona = _personaRepository.Get(personaId); - Assert.IsNotNull(persona); - _personaService.Delete(personaId); - } - using (_requestEmulator.Invoke()) - { - var persona = _personaRepository.Get(personaId); - Assert.IsNull(persona); - } - } - } -} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Cruds/PersonaCrudMemoryTests.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -using System; -using AltNetHispano.Agendas.Domain; -using AltNetHispano.Agendas.Repositories.Memory; -using Moq; -using NUnit.Framework; - -namespace AltNetHispano.Agendas.Tests.Cruds -{ - [TestFixture] - public class PersonaCrudMemoryTests : IPersonaCrudTest - { - private PersonaCrud _test; - - #region SetUp - - [SetUp] - public void BorrarRepositorios() - { - PersonaRepository.Clear(); - } - - [SetUp] - public void SetearUsuario() - { - var seguridad = new Mock<ISeguridad>(); - seguridad.Setup(s => s.GetUserName()).Returns("neluz"); - IdentityContext.Init(seguridad.Object, new PersonaRepository()); - } - - [SetUp] - public void CreateCrud() - { - _test = new PersonaCrud(() => new PersonaRepository(), () => new Mock<IDisposable>().Object, - () => new EventoRepository()); - } - - #endregion - - [Test] - public void CreateAdministrador() - { - _test.CreateAdministrador(); - } - - [Test] - public void ReadAdministrador() - { - _test.ReadAdministrador(); - } - - [Test] - public void CreateUsuario() - { - _test.CreateUsuario(); - } - - [Test] - public void ReadUsuario() - { - _test.ReadUsuario(); - } - - [Test] - public void Update() - { - _test.Update(); - } - - [Test] - public void Delete() - { - _test.Delete(); - } - } -} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Cruds/PersonaCrudNhTests.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -using Agendas.NHibernate; -using AltNetHispano.Agendas.Domain; -using AltNetHispano.Agendas.Repositories.NHibernate; -using Moq; -using NHibernate; -using NUnit.Framework; - -namespace AltNetHispano.Agendas.Tests.Cruds -{ - [TestFixture] - public class PersonaCrudNhTests : IPersonaCrudTest - { - private PersonaCrud _test; - - #region SetUp - - [SetUp] - public void BorrarRepositorios() - { - NhHelperTest.CleanDb(); - } - - [SetUp] - public void SetearUsuario() - { - var seguridad = new Mock<ISeguridad>(); - seguridad.Setup(s => s.GetUserName()).Returns("neluz"); - IdentityContext.Init(seguridad.Object, new PersonaRepository(NhHelper.GetSessionFactory())); - } - - [SetUp] - public void CreateCrud() - { - ISessionFactory sessionFactory = NhHelper.GetSessionFactory(); - _test = new PersonaCrud(() => new PersonaRepository(sessionFactory), () => new RequestEmulator(sessionFactory), - () => new EventoRepository(sessionFactory)); - } - - #endregion - - [Test] - public void CreateAdministrador() - { - _test.CreateAdministrador(); - } - - [Test] - public void ReadAdministrador() - { - _test.ReadAdministrador(); - } - - [Test] - public void CreateUsuario() - { - _test.CreateUsuario(); - } - - [Test] - public void ReadUsuario() - { - _test.ReadUsuario(); - } - - [Test] - public void Update() - { - _test.Update(); - } - - [Test] - public void Delete() - { - _test.Delete(); - } - } -} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Cruds/RequestEmulator.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -using System; -using NHibernate; -using NHibernate.Context; - -namespace AltNetHispano.Agendas.Tests.Cruds -{ - public class RequestEmulator : IDisposable - { - private readonly ISession _session; - - public RequestEmulator(ISessionFactory sessionFactory) - { - _session = sessionFactory.OpenSession(); - CurrentSessionContext.Bind(_session); - } - - public void Dispose() - { - _session.Flush(); - _session.Close(); - } - } -} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Cruds/SchemaNhTests.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -using System; -using System.Xml; -using System.Xml.Serialization; -using Agendas.NHibernate; -using NHibernate.Cfg.MappingSchema; -using NHibernate.Tool.hbm2ddl; -using NUnit.Framework; - -namespace AltNetHispano.Agendas.Tests.Cruds -{ - [TestFixture] - public class SchemaNhTests - { - [Test] - public void ValidateSchema() - { - var cfg = NhHelper.GetConfiguration(); - - var schemaValidator = new SchemaValidator(cfg); - schemaValidator.Validate(); - } - - [Test] - public void BuildSessionFactory() - { - var cfg = NhHelper.GetConfiguration(); - - var sessionfactory = cfg.BuildSessionFactory(); - - Assert.IsNotNull(sessionfactory); - } - - [Test] - public void ShowMapping() - { - var mapping = NhHelper.GetMapping(); - - var setting = new XmlWriterSettings { Indent = true }; - - var serializer = new XmlSerializer(typeof(HbmMapping)); - - var xw = XmlWriter.Create(Console.Out, setting); - - serializer.Serialize(xw, mapping); - } - - [Test] - public void LimpiarDb() - { - NhHelperTest.CleanDb(); - - var sf = NhHelper.GetSessionFactory(); - - var session = sf.OpenSession(); - - var query = session.CreateQuery("from System.Object"); - - Assert.IsEmpty(query.List()); - } - } -} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/EventoStateTests.cs Tue Sep 13 09:01:58 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Tests/EventoStateTests.cs Mon Sep 19 18:18:17 2011 -0300 @@ -1,6 +1,6 @@ using System.Linq; -using Agendas.NHibernate; using AltNetHispano.Agendas.Domain; +using AltNetHispano.Agendas.Domain.Repositories; using NUnit.Framework; namespace AltNetHispano.Agendas.Tests @@ -11,7 +11,7 @@ [Test] public void Check_all() { - var definidos = EventoStateType.All; + var definidos = EventoStateRepository.All; var types = typeof (EventoState).Assembly.GetTypes();
--- a/Agendas/trunk/src/Agendas.Tests/Workflows/Workflow.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -using System; -using System.Linq; -using AltNetHispano.Agendas.Domain; -using AltNetHispano.Agendas.Domain.Repositories; -using NUnit.Framework; - -namespace AltNetHispano.Agendas.Tests.Workflows -{ - internal class Workflow - { - private readonly Func<IDisposable> _requestEmulator; - private readonly Agenda _agenda; - private readonly IEventoRepository _eventoRepository; - private Guid _eventoId; - - public Workflow(IPublicador publicador, IEventoRepository eventoRepository, IPersonaRepository personaRepository, - Func<IDisposable> requestEmulator) - { - _requestEmulator = requestEmulator; - _eventoRepository = eventoRepository; - _agenda = new Agenda(publicador, eventoRepository, personaRepository); - } - - public void Proponer() - { - using (_requestEmulator.Invoke()) - { - var resultado = _agenda.Proponer("SOLID", TestsHelper.GetOrCreatePonente("Jorge"), null, TipoEvento.Van); - Assert.IsTrue(resultado.Succeful); - } - - GetId(); - } - - - public void Agendar() - { - using (_requestEmulator.Invoke()) - { - var fechaInicio = DateTime.Today.AddDays(5).ToUniversalTime(); - var fechaTermino = fechaInicio.AddHours(2); - var resultado = _agenda.Agendar("SOLID", TestsHelper.GetOrCreatePonente("Jorge"), fechaInicio, fechaTermino, null, - TipoEvento.Van); - Assert.IsTrue(resultado.Succeful); - } - - GetId(); - } - - private void GetId() - { - using (_requestEmulator.Invoke()) - { - var evento = _eventoRepository.GetActivos().SingleOrDefault(); - Assert.IsNotNull(evento); - _eventoId = evento.Id; - } - } - - public void Confirmar() - { - using (_requestEmulator.Invoke()) - { - var resultado = _agenda.Confirmar(_eventoId); - Assert.IsTrue(resultado.Succeful); - } - } - - public void Publicar() - { - using (_requestEmulator.Invoke()) - { - var resultado = _agenda.Publicar(_eventoId, 1, "http://www.altnethispano.org/", new TimeSpan(2, 11, 0)); - Assert.IsTrue(resultado.Succeful); - } - } - - public void Cancelar() - { - using (_requestEmulator.Invoke()) - { - var resultado = _agenda.Cancelar(_eventoId); - Assert.IsTrue(resultado.Succeful); - } - } - - public void Descartar() - { - using (_requestEmulator.Invoke()) - { - var resultado = _agenda.Descartar(_eventoId); - Assert.IsTrue(resultado.Succeful); - } - } - - public void ReProponer() - { - using (_requestEmulator.Invoke()) - { - var resultado = _agenda.ReProponer(_eventoId); - Assert.IsTrue(resultado.Succeful); - } - } - - public void ReAgendar() - { - using (_requestEmulator.Invoke()) - { - var resultado = _agenda.ReAgendar(_eventoId); - Assert.IsTrue(resultado.Succeful); - } - } - } -} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Workflows/WorkflowMemoryTests.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,164 +0,0 @@ -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, () => 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
--- a/Agendas/trunk/src/Agendas.Tests/Workflows/WorkflowNhTests.cs Tue Sep 13 09:01:58 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,164 +0,0 @@ -using System.Collections.Generic; -using Agendas.NHibernate; -using AltNetHispano.Agendas.Domain; -using AltNetHispano.Agendas.Tests.Cruds; -using Moq; -using NUnit.Framework; - -namespace AltNetHispano.Agendas.Tests.Workflows -{ - [TestFixture] - public class WorkflowNhTests : TestBase - { - private Mock<IPublicador> _publicador; - private Workflow _workflow; - - [SetUp] - public void InitPublicador() - { - _publicador = new Mock<IPublicador>(); - _workflow = new Workflow(_publicador.Object, DefaultEventoRepository, DefaultPersonaRepository, () => new RequestEmulator(NhHelper.GetSessionFactory())); - } - - [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
--- a/Agendas/trunk/src/Agendas.sln Tue Sep 13 09:01:58 2011 -0300 +++ b/Agendas/trunk/src/Agendas.sln Mon Sep 19 18:18:17 2011 -0300 @@ -40,6 +40,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Agendas.Web.Tests", "Agendas.Web.Tests\Agendas.Web.Tests.csproj", "{10FECBBD-F07F-4721-87DA-D3184CF86C90}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Agendas.Repositories.Tests", "Agendas.Repositories.Tests\Agendas.Repositories.Tests.csproj", "{BFCD197C-01D5-4645-B0DF-053867E16FDE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -110,6 +112,10 @@ {10FECBBD-F07F-4721-87DA-D3184CF86C90}.Debug|Any CPU.Build.0 = Debug|Any CPU {10FECBBD-F07F-4721-87DA-D3184CF86C90}.Release|Any CPU.ActiveCfg = Release|Any CPU {10FECBBD-F07F-4721-87DA-D3184CF86C90}.Release|Any CPU.Build.0 = Release|Any CPU + {BFCD197C-01D5-4645-B0DF-053867E16FDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BFCD197C-01D5-4645-B0DF-053867E16FDE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BFCD197C-01D5-4645-B0DF-053867E16FDE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BFCD197C-01D5-4645-B0DF-053867E16FDE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE
--- a/Agendas/trunk/src/install packages.bat Tue Sep 13 09:01:58 2011 -0300 +++ b/Agendas/trunk/src/install packages.bat Mon Sep 19 18:18:17 2011 -0300 @@ -1,5 +1,6 @@ ..\tools\nuget i Agendas.Tests\packages.config -o packages ..\tools\nuget i Agendas.Repositories.NHibernate\packages.config -o packages +..\tools\nuget i Agendas.Repositories.Tests\packages.config -o packages ..\tools\nuget i Agendas.NHibernate\packages.config -o packages ..\tools\nuget i Agendas.Web\packages.config -o packages ..\tools\nuget i Agendas.Twitter\packages.config -o packages