diff Agendas/trunk/src/Agendas.Tests/Cruds/PersonaCrud.cs @ 209:a36a76bd6ec3

Se soluciona ticket 173. Se agrega eliminación de personas siempre y cuando no esté asociada a ninguna van.
author alabra
date Wed, 24 Aug 2011 19:27:30 -0300
parents 222362c29416
children b9850b647a4e
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Tests/Cruds/PersonaCrud.cs	Wed Aug 24 11:30:06 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Tests/Cruds/PersonaCrud.cs	Wed Aug 24 19:27:30 2011 -0300
@@ -12,11 +12,13 @@
 		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)
+		public PersonaCrud(Func<IPersonaRepository> createpersonaRepository, Func<IDisposable> requestEmulator, Func<IEventoRepository> createEventoRespository)
 		{
 			_personaRepository = createpersonaRepository.Invoke();
-			_personaService = new PersonaService(_personaRepository);
+		    _eventoRepository = createEventoRespository.Invoke();
+			_personaService = new PersonaService(_personaRepository, _eventoRepository);
 			_requestEmulator = requestEmulator;
 		}
 
@@ -118,5 +120,20 @@
 				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