annotate Agendas/trunk/src/Agendas.Tests/Cruds/PatrocinadorCrudMemoryTests.cs @ 147:5a1f7233aa5a

Agregando algunos tests
author Nelo@Guinea.neluz.int
date Mon, 01 Aug 2011 17:34:35 -0300
parents 2d1adbaf0373
children 5346c0500594
rev   line source
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
1 using System;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
2 using AltNetHispano.Agendas.Domain;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
3 using AltNetHispano.Agendas.Repositories.Memory;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
4 using Moq;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
5 using NUnit.Framework;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
6
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
7 namespace AltNetHispano.Agendas.Tests.Cruds
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
8 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
9 [TestFixture]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
10 public class PatrocinadorCrudMemoryTests
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
11 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
12 private PatrocinadorCrud _eventoCrud;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
13
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
14 #region SetUp
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
15
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
16 [SetUp]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
17 public void BorrarRepositorios()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
18 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
19 PatrocinadorRepository.Clear();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
20 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
21
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
22 [SetUp]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
23 public void SetearUsuario()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
24 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
25 var seguridad = new Mock<ISeguridad>();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
26 seguridad.Setup(s => s.GetUserName()).Returns("neluz");
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
27 IdentityContext.Init(seguridad.Object, new PersonaRepository());
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
28 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
29
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
30 [SetUp]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
31 public void CreateCrud()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
32 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
33 _eventoCrud = new PatrocinadorCrud(() => new PatrocinadorRepository(), () => new Mock<IDisposable>().Object);
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
34 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
35
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
36 #endregion
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
37
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
38 [Test]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
39 public void Create()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
40 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
41 _eventoCrud.Create();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
42 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
43
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
44 [Test]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
45 public void Read()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
46 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
47 _eventoCrud.Read();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
48 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
49
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
50 [Test]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
51 public void Update()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
52 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
53 _eventoCrud.Update();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
54 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
55
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
56 [Test]
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
57 public void Delete()
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
58 {
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
59 _eventoCrud.Delete();
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
60 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
61
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
62 }
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
63 }