Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. using System;
  2. using Visitor;
  3.  
  4. public class Program {
  5. public static void Main () {
  6. var baseEntry = new SimpleLogEntry () {
  7. Created = DateTime.Now,
  8. Message = "test"
  9. };
  10.  
  11. var simpleEntry = new SimpleLogEntry (baseEntry) {
  12. AdditionalInfo = "additional"
  13. };
  14.  
  15. var exceptionEntry = new ExceptionLogEntry (baseEntry) {
  16. ExceptionCode = 111
  17. };
  18. //it is possible to declare multiple visitors for particular hierarchy of objects
  19. // for example: PersistentLogEntryVisitors that allows to process LogEntries and save them to storage
  20. var visitor = new LogEntryVisitor ();
  21. visitor.ProcessLogEntry (simpleEntry);
  22. Assert.Contains ("simple", visitor.State);
  23. visitor.ProcessLogEntry (exceptionEntry);
  24. Assert.Contains ("exception", visitor.State);
  25. TestRunner.Print ();
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement