annotate Agendas/trunk/src/Agendas.Tests/EventoTests.cs @ 24:41b283d27e3e

Ponentes como entidad Agenda no es una entidad persistente (por ahora)
author nelo@MTEySS.neluz.int
date Tue, 15 Mar 2011 07:49:53 -0300
parents 05996fa19e04
children 475be11edf56
rev   line source
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
1 using System;
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
2 using Agendas.Repositories.Memory;
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
3 using AltNetHispano.Agendas.Domain;
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
4 using AltNetHispano.Agendas.Domain.Repositories;
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
5 using NUnit.Framework;
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
6
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
7 namespace AltNetHispano.Agendas.Tests
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
8 {
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
9 [TestFixture]
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
10 public class EventoTests
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
11 {
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
12 [Test]
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
13 public void Van_crud()
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
14 {
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
15 Guid vanId;
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
16 {
12
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 3
diff changeset
17 var van = new Evento
3
5f007e266509 code cleanup
nelopauselli
parents: 2
diff changeset
18 {
5f007e266509 code cleanup
nelopauselli
parents: 2
diff changeset
19 Titulo = "TDD - Diseño Basado en Ejemplos",
24
41b283d27e3e Ponentes como entidad
nelo@MTEySS.neluz.int
parents: 12
diff changeset
20 Ponente = new Ponente {Nombre = "Carlos Blé"},
3
5f007e266509 code cleanup
nelopauselli
parents: 2
diff changeset
21 Fecha = new DateTime(2010, 04, 16)
5f007e266509 code cleanup
nelopauselli
parents: 2
diff changeset
22 };
12
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 3
diff changeset
23 IEventoRepository eventoRepository = new EventoRepository();
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
24
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
25 eventoRepository.Save(van);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
26 vanId = van.Id;
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
27 }
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
28
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
29 const string sintesis =
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
30 "Durante la primera hora se habló de los principios SOLID, de BDD, TDD y ATDD. Discusión entre las diferencias entre TDD y BDD, así como también sobre algunas cuestiones relativas a la nomenclatura.\n Durante la segunda hora se realizó un ejercicio práctico demostrando como se comienza a practicar TDD.\n La última parte de la VAN es la mas interesante respecto a lo que es TDD y como se practica.";
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
31
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
32 {
12
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 3
diff changeset
33 IEventoRepository eventoRepository = new EventoRepository();
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
34
12
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 3
diff changeset
35 Evento van = eventoRepository.Get(vanId);
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
36
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
37 Assert.IsNotNull(van);
24
41b283d27e3e Ponentes como entidad
nelo@MTEySS.neluz.int
parents: 12
diff changeset
38 Assert.AreEqual("Carlos Blé", van.Ponente.Nombre);
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
39 Assert.AreEqual("TDD - Diseño Basado en Ejemplos", van.Titulo);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
40 Assert.AreEqual(new DateTime(2010, 04, 16), van.Fecha);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
41
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
42 van.Sintesis = sintesis;
3
5f007e266509 code cleanup
nelopauselli
parents: 2
diff changeset
43 van.Enlaces = new[] {"www.carlosble.com", "www.dirigidoPorTests.com"};
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
44 van.Fecha = new DateTime(2010, 04, 17);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
45
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
46 eventoRepository.Update(van);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
47 }
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
48
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
49 {
12
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 3
diff changeset
50 IEventoRepository eventoRepository = new EventoRepository();
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
51
12
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 3
diff changeset
52 Evento van = eventoRepository.Get(vanId);
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
53
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
54 Assert.IsNotNull(van);
24
41b283d27e3e Ponentes como entidad
nelo@MTEySS.neluz.int
parents: 12
diff changeset
55 Assert.AreEqual("Carlos Blé", van.Ponente.Nombre);
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
56 Assert.AreEqual("TDD - Diseño Basado en Ejemplos", van.Titulo);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
57 Assert.AreEqual(new DateTime(2010, 04, 17), van.Fecha);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
58 Assert.AreEqual(sintesis, van.Sintesis);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
59 Assert.IsNotNull(van.Enlaces);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
60 Assert.AreEqual(2, van.Enlaces.Count);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
61 Assert.AreEqual("www.carlosble.com", van.Enlaces[0]);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
62 Assert.AreEqual("www.dirigidoPorTests.com", van.Enlaces[1]);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
63
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
64 eventoRepository.Delete(van);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
65 }
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
66
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
67 {
12
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 3
diff changeset
68 IEventoRepository eventoRepository = new EventoRepository();
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
69
12
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 3
diff changeset
70 Evento van = eventoRepository.Get(vanId);
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
71
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
72 Assert.IsNull(van);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
73 }
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
74 }
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
75 }
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
76 }