Guest User

Untitled

a guest
Apr 25th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. public class TestClient
  2. {
  3. // no need for additional methods, properties, or delegates
  4.  
  5. // All internal state needs to be declared as protected proterties
  6. protected virtual Address Address { get; set; }
  7.  
  8. // Domain behavior does not have to be virtual, nor return anything
  9. public void ClientMoves(Address address)
  10. {
  11. // branch
  12. if(address.IsOnMars)
  13. {
  14. //multiple published events
  15. ClientMovedToMars(address);
  16. ClientNoLongerLivesOnEarth(address);
  17. }
  18. else
  19. {
  20. ClientMoved(address);
  21. }
  22. }
  23. protected virtual ClientMovedEvent ClientMoved(Address address)
  24. {
  25. return new ClientMovedEvent(address);
  26. }
  27. protected virtual ClientNoLongerLivesOnEarthEvent ClientNoLongerLivesOnEarth(Address address)
  28. {
  29. return new ClientNoLongerLivesOnEarthEvent(address);
  30. }
  31. protected virtual ClientMovedToMarsEvent ClientMovedToMars(Address address)
  32. {
  33. return new ClientMovedToMarsEvent(address);
  34. }
  35. }
Add Comment
Please, Sign In to add comment