annotate Agendas/trunk/src/Agendas.Tests/EventoTests.cs @ 2:c03560ae4762

Test de Crud para la agenda
author nelopauselli
date Sat, 22 Jan 2011 20:21:31 -0300
parents 6bb4ab4c0611
children 5f007e266509
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 {
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
17 var van = new Van
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
18 {
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
19 Titulo = "TDD - Diseño Basado en Ejemplos",
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
20 Ponente = "Carlos Blé",
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
21 Fecha = new DateTime(2010, 04, 16)
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
22 };
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
23 IVanRepository eventoRepository = new VanRepository();
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 {
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
33 IVanRepository eventoRepository = new VanRepository();
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
34
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
35 var van = eventoRepository.Get(vanId);
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);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
38 Assert.AreEqual("Carlos Blé", van.Ponente);
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;
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
43 van.Enlaces = new[] { "www.carlosble.com", "www.dirigidoPorTests.com" };
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 {
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
50 IVanRepository eventoRepository = new VanRepository();
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
51
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
52 var van = eventoRepository.Get(vanId);
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);
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
55 Assert.AreEqual("Carlos Blé", van.Ponente);
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 {
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
68 IVanRepository eventoRepository = new VanRepository();
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
69
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
70 var van = eventoRepository.Get(vanId);
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 }
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
75
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
76 [Test]
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
77 public void Cafe_crud()
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
78 {
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
79 Guid cafeId;
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
80 {
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
81 var cafe = new Cafe
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
82 {
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
83 Titulo = "La Inmortalidad de la Medusa - Arquitectura",
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
84 Fecha = new DateTime(2010, 08, 27),
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
85 };
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
86 ICafeRepository eventoRepository = new CafeRepository();
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
87
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
88 eventoRepository.Save(cafe);
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
89 cafeId = cafe.Id;
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
90 }
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
91
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
92 const string sintesis =
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
93 "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.";
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
94
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
95 {
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
96 ICafeRepository eventoRepository = new CafeRepository();
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
97
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
98 var cafe = eventoRepository.Get(cafeId);
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
99
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
100 Assert.IsNotNull(cafe);
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
101 Assert.AreEqual("La Inmortalidad de la Medusa - Arquitectura", cafe.Titulo);
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
102 Assert.AreEqual(new DateTime(2010, 08, 27), cafe.Fecha);
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
103
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
104 cafe.Sintesis = sintesis;
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
105
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
106 eventoRepository.Update(cafe);
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
107 }
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
108
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
109 {
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
110 ICafeRepository eventoRepository = new CafeRepository();
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
111
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
112 var cafe = eventoRepository.Get(cafeId);
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
113
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
114 Assert.IsNotNull(cafe);
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
115 Assert.AreEqual("La Inmortalidad de la Medusa - Arquitectura", cafe.Titulo);
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
116 Assert.AreEqual(new DateTime(2010, 08, 27), cafe.Fecha);
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
117 Assert.AreEqual(sintesis, cafe.Sintesis);
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
118
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
119 eventoRepository.Delete(cafe);
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
120 }
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
121
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
122 {
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
123 ICafeRepository eventoRepository = new CafeRepository();
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
124
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
125 var cafe = eventoRepository.Get(cafeId);
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
126
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
127 Assert.IsNull(cafe);
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
128 }
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents: 1
diff changeset
129 }
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
130 }
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
131 }