178
|
1 using System;
|
|
2 using AltNetHispano.Agendas.Domain;
|
|
3 using AltNetHispano.Agendas.Repositories.Memory;
|
|
4 using Moq;
|
|
5 using NUnit.Framework;
|
|
6
|
|
7 namespace AltNetHispano.Agendas.Tests.Cruds
|
|
8 {
|
|
9 [TestFixture]
|
|
10 public class PersonaCrudMemoryTests : IPersonaCrudTest
|
|
11 {
|
|
12 private PersonaCrud _test;
|
|
13
|
|
14 #region SetUp
|
|
15
|
|
16 [SetUp]
|
|
17 public void BorrarRepositorios()
|
|
18 {
|
|
19 PersonaRepository.Clear();
|
|
20 }
|
|
21
|
|
22 [SetUp]
|
|
23 public void SetearUsuario()
|
|
24 {
|
|
25 var seguridad = new Mock<ISeguridad>();
|
|
26 seguridad.Setup(s => s.GetUserName()).Returns("neluz");
|
|
27 IdentityContext.Init(seguridad.Object, new PersonaRepository());
|
|
28 }
|
|
29
|
|
30 [SetUp]
|
|
31 public void CreateCrud()
|
|
32 {
|
|
33 _test = new PersonaCrud(() => new PersonaRepository(), () => new Mock<IDisposable>().Object);
|
|
34 }
|
|
35
|
|
36 #endregion
|
|
37
|
|
38 [Test]
|
|
39 public void CreateAdministrador()
|
|
40 {
|
|
41 _test.CreateAdministrador();
|
|
42 }
|
|
43
|
|
44 [Test]
|
|
45 public void ReadAdministrador()
|
|
46 {
|
|
47 _test.ReadAdministrador();
|
|
48 }
|
|
49
|
|
50 [Test]
|
|
51 public void CreateUsuario()
|
|
52 {
|
|
53 _test.CreateUsuario();
|
|
54 }
|
|
55
|
|
56 [Test]
|
|
57 public void ReadUsuario()
|
|
58 {
|
|
59 _test.ReadUsuario();
|
|
60 }
|
|
61
|
|
62 [Test]
|
|
63 public void Update()
|
|
64 {
|
|
65 _test.Update();
|
|
66 }
|
|
67 }
|
|
68 } |