annotate Agendas/trunk/src/Agendas.Tests/EventoTests.cs @ 1:6bb4ab4c0611

Tests de Crud para repositorio de Vans
author nelopauselli
date Sat, 22 Jan 2011 19:50:32 -0300
parents
children c03560ae4762
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]
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
13 public void Crud()
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 };
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
23 IVanRepository eventoRepository = new VanRepositoryMemory();
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 {
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
33 IVanRepository eventoRepository = new VanRepositoryMemory();
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 {
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
50 IVanRepository eventoRepository = new VanRepositoryMemory();
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 {
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents:
diff changeset
68 IVanRepository eventoRepository = new VanRepositoryMemory();
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 }
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 }