PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/Microsoft.AspNet.SignalR.Tests/Server/TestSubscriber.cs

https://github.com/mip1983/SignalR
C# | 40 lines | 33 code | 7 blank | 0 comment | 4 complexity | 77dc0101e36710aa9168edb634fbe8ad MD5 | raw file
Possible License(s): Apache-2.0, CC-BY-SA-3.0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Microsoft.AspNet.SignalR.Tests.Server
  6. {
  7. public class TestSubscriber : ISubscriber
  8. {
  9. public TestSubscriber(IEnumerable<string> keys)
  10. {
  11. EventKeys = keys;
  12. Identity = Guid.NewGuid().ToString();
  13. }
  14. public IEnumerable<string> EventKeys { get; private set; }
  15. public string Identity { get; private set; }
  16. public event Action<string> EventAdded;
  17. public event Action<string> EventRemoved;
  18. public void AddEvent(string eventName)
  19. {
  20. if (EventAdded != null)
  21. {
  22. EventAdded(eventName);
  23. }
  24. }
  25. public void RemoveEvent(string eventName)
  26. {
  27. if (EventRemoved != null)
  28. {
  29. EventRemoved(eventName);
  30. }
  31. }
  32. }
  33. }