Mercurial > altnet-hispano
annotate Agendas/trunk/src/Agendas.Domain/EventoConfirmadoState.cs @ 134:a4ef6874ec81
Se termina prueba unitaria que verifica que se cree el evento solo si la acción es Agendar.
author | alabra |
---|---|
date | Sun, 17 Jul 2011 13:58:31 -0400 |
parents | 53bcd338542b |
children | 3639803112c6 |
rev | line source |
---|---|
116
53bcd338542b
acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents:
104
diff
changeset
|
1 using System; |
53bcd338542b
acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents:
104
diff
changeset
|
2 using AltNetHispano.Agendas.Domain.Exceptions; |
101
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
3 |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
4 namespace AltNetHispano.Agendas.Domain |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
5 { |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
6 public class EventoConfirmadoState : EventoState |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
7 { |
104 | 8 private EventoConfirmadoState() |
9 { | |
10 } | |
11 | |
12 private static readonly EventoState _instance = new EventoConfirmadoState(); | |
13 public static EventoState GetInstance() | |
14 { | |
15 return _instance; | |
16 } | |
17 | |
18 private const string Descripcion = "Confirmado"; | |
101
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
19 |
103 | 20 public override void Promover(Evento evento, Accion accion) |
101
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
21 { |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
22 switch (accion) |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
23 { |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
24 case Accion.Publicar: |
104 | 25 evento.SetEstado(EventoPublicadoState.GetInstance()); |
103 | 26 evento.AddTrack(new Track(evento, Accion.Publicar)); |
101
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
27 break; |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
28 default: |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
29 throw new AccionNoSoportadaException(this.GetType(), accion); |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
30 } |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
31 } |
103 | 32 |
33 public override string GetDescripcion() | |
34 { | |
35 return Descripcion; | |
36 } | |
116
53bcd338542b
acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents:
104
diff
changeset
|
37 |
53bcd338542b
acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents:
104
diff
changeset
|
38 public override bool PuedePromover(Accion accion) |
53bcd338542b
acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents:
104
diff
changeset
|
39 { |
53bcd338542b
acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents:
104
diff
changeset
|
40 return accion == Accion.Publicar; |
53bcd338542b
acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents:
104
diff
changeset
|
41 } |
101
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
42 } |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
43 } |