# HG changeset patch # User nelopauselli # Date 1295738630 10800 # Node ID 5f007e2665096a8c01b49cebf638f7edaad64d86 # Parent c03560ae4762fbb33905cc3cb3790d0772c81410 code cleanup diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Domain/Agenda.cs --- a/Agendas/trunk/src/Agendas.Domain/Agenda.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Domain/Agenda.cs Sat Jan 22 20:23:50 2011 -0300 @@ -5,18 +5,10 @@ { public class Agenda { + private readonly IList _eventos; private readonly IPublicador _publicador; private readonly IRecordador _recordador; - public Guid Id { get; set; } - - private readonly IList _eventos; - public IEnumerable Eventos - { - get { return _eventos; } - } - - public Agenda(IPublicador publicador, IRecordador recordador) { _publicador = publicador; @@ -24,6 +16,14 @@ _eventos = new List(); } + public Guid Id { get; set; } + + public IEnumerable Eventos + { + get { return _eventos; } + } + + public void Publicar(Evento evento) { _eventos.Add(evento); diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Domain/Cafe.cs --- a/Agendas/trunk/src/Agendas.Domain/Cafe.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Domain/Cafe.cs Sat Jan 22 20:23:50 2011 -0300 @@ -1,6 +1,4 @@ -using System; - -namespace AltNetHispano.Agendas.Domain +namespace AltNetHispano.Agendas.Domain { public class Cafe : Evento { diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Domain/CompositePublicador.cs --- a/Agendas/trunk/src/Agendas.Domain/CompositePublicador.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Domain/CompositePublicador.cs Sat Jan 22 20:23:50 2011 -0300 @@ -14,10 +14,14 @@ _publicadores = publicadores; } + #region IPublicador Members + public void Publicar(Evento evento) { - foreach (var publicador in _publicadores) + foreach (IPublicador publicador in _publicadores) publicador.Publicar(evento); } + + #endregion } } \ No newline at end of file diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Domain/Evento.cs --- a/Agendas/trunk/src/Agendas.Domain/Evento.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Domain/Evento.cs Sat Jan 22 20:23:50 2011 -0300 @@ -8,6 +8,5 @@ public string Titulo { get; set; } public DateTime Fecha { get; set; } public string Sintesis { get; set; } - } } \ No newline at end of file diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Domain/Properties/AssemblyInfo.cs --- a/Agendas/trunk/src/Agendas.Domain/Properties/AssemblyInfo.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Domain/Properties/AssemblyInfo.cs Sat Jan 22 20:23:50 2011 -0300 @@ -1,10 +1,10 @@ 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.Domain")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] @@ -17,9 +17,11 @@ // 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("a184442c-dbbb-407e-9901-941c67fdbefc")] // Version information for an assembly consists of the following four values: @@ -32,5 +34,6 @@ // 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")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Domain/Van.cs --- a/Agendas/trunk/src/Agendas.Domain/Van.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Domain/Van.cs Sat Jan 22 20:23:50 2011 -0300 @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace AltNetHispano.Agendas.Domain { diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Google/GooglePublicador.cs --- a/Agendas/trunk/src/Agendas.Google/GooglePublicador.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Google/GooglePublicador.cs Sat Jan 22 20:23:50 2011 -0300 @@ -5,9 +5,13 @@ { public class GooglePublicador : IPublicador { + #region IPublicador Members + public void Publicar(Evento evento) { throw new NotImplementedException(); } + + #endregion } } \ No newline at end of file diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Google/Properties/AssemblyInfo.cs --- a/Agendas/trunk/src/Agendas.Google/Properties/AssemblyInfo.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Google/Properties/AssemblyInfo.cs Sat Jan 22 20:23:50 2011 -0300 @@ -1,10 +1,10 @@ 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.Google")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] @@ -17,9 +17,11 @@ // 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("35390a1c-6523-4255-adc7-562231cacae3")] // Version information for an assembly consists of the following four values: @@ -32,5 +34,6 @@ // 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")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Repositories.Memory/AgendaRepository.cs --- a/Agendas/trunk/src/Agendas.Repositories.Memory/AgendaRepository.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Repositories.Memory/AgendaRepository.cs Sat Jan 22 20:23:50 2011 -0300 @@ -9,6 +9,8 @@ { protected static readonly IDictionary Agendas = new Dictionary(); + #region IAgendaRepository Members + public void Save(Agenda agenda) { if (Guid.Empty.Equals(agenda.Id)) @@ -32,7 +34,8 @@ { Agenda agenda; return Agendas.TryGetValue(agendaId, out agenda) ? agenda : null; + } - } + #endregion } } \ No newline at end of file diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Repositories.Memory/CafeRepository.cs --- a/Agendas/trunk/src/Agendas.Repositories.Memory/CafeRepository.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Repositories.Memory/CafeRepository.cs Sat Jan 22 20:23:50 2011 -0300 @@ -4,12 +4,16 @@ namespace Agendas.Repositories.Memory { - public class CafeRepository : EventoRepository, ICafeRepository + public class CafeRepository : EventoRepository, ICafeRepository { + #region ICafeRepository Members + public Cafe Get(Guid vanId) { Evento evento; return Eventos.TryGetValue(vanId, out evento) ? evento as Cafe : null; } + + #endregion } } \ No newline at end of file diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Repositories.Memory/Properties/AssemblyInfo.cs --- a/Agendas/trunk/src/Agendas.Repositories.Memory/Properties/AssemblyInfo.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Repositories.Memory/Properties/AssemblyInfo.cs Sat Jan 22 20:23:50 2011 -0300 @@ -1,10 +1,10 @@ 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.Memory")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] @@ -17,9 +17,11 @@ // 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("b5eed6a9-cfdc-4f27-8629-bcfa976ac30a")] // Version information for an assembly consists of the following four values: @@ -32,5 +34,6 @@ // 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")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Repositories.Memory/VanRepository.cs --- a/Agendas/trunk/src/Agendas.Repositories.Memory/VanRepository.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Repositories.Memory/VanRepository.cs Sat Jan 22 20:23:50 2011 -0300 @@ -6,10 +6,14 @@ { public class VanRepository : EventoRepository, IVanRepository { + #region IVanRepository Members + public Van Get(Guid vanId) { Evento evento; return Eventos.TryGetValue(vanId, out evento) ? evento as Van : null; } + + #endregion } } \ No newline at end of file diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Tests/AgendaTests.cs --- a/Agendas/trunk/src/Agendas.Tests/AgendaTests.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Tests/AgendaTests.cs Sat Jan 22 20:23:50 2011 -0300 @@ -12,6 +12,19 @@ public class AgendaTests { [Test] + public void Publicar_cafe() + { + var publicador = new Mock(); + + var agenda = new Agenda(publicador.Object, null); + + var cafe = new Cafe(); + agenda.Publicar(cafe); + + publicador.Verify(p => p.Publicar(It.IsAny()), Times.Exactly(1)); + } + + [Test] public void Publicar_van() { var publicador = new Mock(); @@ -25,25 +38,12 @@ } [Test] - public void Publicar_cafe() - { - var publicador = new Mock(); - - var agenda = new Agenda(publicador.Object, null); - - var cafe = new Cafe(); - agenda.Publicar(cafe); - - publicador.Verify(p => p.Publicar(It.IsAny()), Times.Exactly(1)); - } - - [Test] public void Publicar_van_multiples_publicadores() { var publicador1 = new Mock(); var publicador2 = new Mock(); - var agenda = new Agenda(new CompositePublicador (new[] { publicador1.Object, publicador2.Object } ), null); + var agenda = new Agenda(new CompositePublicador(new[] {publicador1.Object, publicador2.Object}), null); var cafe = new Cafe(); agenda.Publicar(cafe); @@ -59,7 +59,7 @@ var publicador2 = new Mock(); var recordador1 = new Mock(); - var agenda = new Agenda(new CompositePublicador(new[] { publicador1.Object, publicador2.Object }), recordador1.Object); + var agenda = new Agenda(new CompositePublicador(new[] {publicador1.Object, publicador2.Object}), recordador1.Object); var van = new Van(); agenda.Publicar(van); @@ -90,7 +90,7 @@ { IAgendaRepository agendaRepository = new AgendaRepository(); - var agenda = agendaRepository.Get(vanId); + Agenda agenda = agendaRepository.Get(vanId); Assert.IsNotNull(agenda); Assert.AreEqual(1, agenda.Eventos.Count()); @@ -102,7 +102,7 @@ { IAgendaRepository agendaRepository = new AgendaRepository(); - var agenda = agendaRepository.Get(vanId); + Agenda agenda = agendaRepository.Get(vanId); Assert.IsNotNull(agenda); Assert.AreEqual(2, agenda.Eventos.Count()); @@ -113,10 +113,10 @@ { IAgendaRepository agendaRepository = new AgendaRepository(); - var agenda = agendaRepository.Get(vanId); + Agenda agenda = agendaRepository.Get(vanId); Assert.IsNull(agenda); } } } -} +} \ No newline at end of file diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Tests/EventoTests.cs --- a/Agendas/trunk/src/Agendas.Tests/EventoTests.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Tests/EventoTests.cs Sat Jan 22 20:23:50 2011 -0300 @@ -10,16 +10,71 @@ public class EventoTests { [Test] + public void Cafe_crud() + { + Guid cafeId; + { + var cafe = new Cafe + { + Titulo = "La Inmortalidad de la Medusa - Arquitectura", + Fecha = new DateTime(2010, 08, 27), + }; + ICafeRepository eventoRepository = new CafeRepository(); + + eventoRepository.Save(cafe); + cafeId = cafe.Id; + } + + const string sintesis = + "Se habló sobre la sensación de perdida de control con el uso de frameworks, la Organización en capas de una aplicación, servicios en la web que se combinan.\nSe discutió un poco sobre Testing Unitario vs Test de Integración. Testing con Stubs vs Mocks, la diferencia entre decir que debe hacer un componente y como debe hacerlo.\nSe habló sobre MVVM."; + + { + ICafeRepository eventoRepository = new CafeRepository(); + + Cafe cafe = eventoRepository.Get(cafeId); + + Assert.IsNotNull(cafe); + Assert.AreEqual("La Inmortalidad de la Medusa - Arquitectura", cafe.Titulo); + Assert.AreEqual(new DateTime(2010, 08, 27), cafe.Fecha); + + cafe.Sintesis = sintesis; + + eventoRepository.Update(cafe); + } + + { + ICafeRepository eventoRepository = new CafeRepository(); + + Cafe cafe = eventoRepository.Get(cafeId); + + Assert.IsNotNull(cafe); + Assert.AreEqual("La Inmortalidad de la Medusa - Arquitectura", cafe.Titulo); + Assert.AreEqual(new DateTime(2010, 08, 27), cafe.Fecha); + Assert.AreEqual(sintesis, cafe.Sintesis); + + eventoRepository.Delete(cafe); + } + + { + ICafeRepository eventoRepository = new CafeRepository(); + + Cafe cafe = eventoRepository.Get(cafeId); + + Assert.IsNull(cafe); + } + } + + [Test] public void Van_crud() { Guid vanId; { var van = new Van - { - Titulo = "TDD - Diseño Basado en Ejemplos", - Ponente = "Carlos Blé", - Fecha = new DateTime(2010, 04, 16) - }; + { + Titulo = "TDD - Diseño Basado en Ejemplos", + Ponente = "Carlos Blé", + Fecha = new DateTime(2010, 04, 16) + }; IVanRepository eventoRepository = new VanRepository(); eventoRepository.Save(van); @@ -32,7 +87,7 @@ { IVanRepository eventoRepository = new VanRepository(); - var van = eventoRepository.Get(vanId); + Van van = eventoRepository.Get(vanId); Assert.IsNotNull(van); Assert.AreEqual("Carlos Blé", van.Ponente); @@ -40,7 +95,7 @@ Assert.AreEqual(new DateTime(2010, 04, 16), van.Fecha); van.Sintesis = sintesis; - van.Enlaces = new[] { "www.carlosble.com", "www.dirigidoPorTests.com" }; + van.Enlaces = new[] {"www.carlosble.com", "www.dirigidoPorTests.com"}; van.Fecha = new DateTime(2010, 04, 17); eventoRepository.Update(van); @@ -49,7 +104,7 @@ { IVanRepository eventoRepository = new VanRepository(); - var van = eventoRepository.Get(vanId); + Van van = eventoRepository.Get(vanId); Assert.IsNotNull(van); Assert.AreEqual("Carlos Blé", van.Ponente); @@ -67,65 +122,10 @@ { IVanRepository eventoRepository = new VanRepository(); - var van = eventoRepository.Get(vanId); + Van van = eventoRepository.Get(vanId); Assert.IsNull(van); } } - - [Test] - public void Cafe_crud() - { - Guid cafeId; - { - var cafe = new Cafe - { - Titulo = "La Inmortalidad de la Medusa - Arquitectura", - Fecha = new DateTime(2010, 08, 27), - }; - ICafeRepository eventoRepository = new CafeRepository(); - - eventoRepository.Save(cafe); - cafeId = cafe.Id; - } - - const string sintesis = - "Se habló sobre la sensación de perdida de control con el uso de frameworks, la Organización en capas de una aplicación, servicios en la web que se combinan.\nSe discutió un poco sobre Testing Unitario vs Test de Integración. Testing con Stubs vs Mocks, la diferencia entre decir que debe hacer un componente y como debe hacerlo.\nSe habló sobre MVVM."; - - { - ICafeRepository eventoRepository = new CafeRepository(); - - var cafe = eventoRepository.Get(cafeId); - - Assert.IsNotNull(cafe); - Assert.AreEqual("La Inmortalidad de la Medusa - Arquitectura", cafe.Titulo); - Assert.AreEqual(new DateTime(2010, 08, 27), cafe.Fecha); - - cafe.Sintesis = sintesis; - - eventoRepository.Update(cafe); - } - - { - ICafeRepository eventoRepository = new CafeRepository(); - - var cafe = eventoRepository.Get(cafeId); - - Assert.IsNotNull(cafe); - Assert.AreEqual("La Inmortalidad de la Medusa - Arquitectura", cafe.Titulo); - Assert.AreEqual(new DateTime(2010, 08, 27), cafe.Fecha); - Assert.AreEqual(sintesis, cafe.Sintesis); - - eventoRepository.Delete(cafe); - } - - { - ICafeRepository eventoRepository = new CafeRepository(); - - var cafe = eventoRepository.Get(cafeId); - - Assert.IsNull(cafe); - } - } } } \ No newline at end of file diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Tests/Properties/AssemblyInfo.cs --- a/Agendas/trunk/src/Agendas.Tests/Properties/AssemblyInfo.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Tests/Properties/AssemblyInfo.cs Sat Jan 22 20:23:50 2011 -0300 @@ -1,10 +1,10 @@ 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.Tests")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] @@ -17,9 +17,11 @@ // 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("31d9d06f-bccd-42cb-b534-12fbff76c005")] // Version information for an assembly consists of the following four values: @@ -32,5 +34,6 @@ // 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")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Twitter/Properties/AssemblyInfo.cs --- a/Agendas/trunk/src/Agendas.Twitter/Properties/AssemblyInfo.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Twitter/Properties/AssemblyInfo.cs Sat Jan 22 20:23:50 2011 -0300 @@ -1,10 +1,10 @@ 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.Twitter")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] @@ -17,9 +17,11 @@ // 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("c5bc6dc6-7d9a-4bdf-883a-868738e5a311")] // Version information for an assembly consists of the following four values: @@ -32,5 +34,6 @@ // 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")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff -r c03560ae4762 -r 5f007e266509 Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs --- a/Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs Sat Jan 22 20:21:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs Sat Jan 22 20:23:50 2011 -0300 @@ -5,14 +5,22 @@ { public class TwitterPublicador : IPublicador, IRecordador { + #region IPublicador Members + public void Publicar(Evento evento) { throw new NotImplementedException(); } + #endregion + + #region IRecordador Members + public void Recordar(Evento evento) { throw new NotImplementedException(); } + + #endregion } -} +} \ No newline at end of file