예제 #1
0
    public void AddEventTest()
    {
      var manager = new EventManager();
      IEventRepository repo = new MockEventRepository();
      manager.EventRepository = repo;

      manager.AddEvent(new object(), DateTime.Now);
      Assert.IsTrue(repo.GetEvents().Count() == 1, "Failed to add event");

      var @event = new TestEvent();
      manager.AddEvent(@event, DateTime.UtcNow.AddMinutes(15), "e1");
      manager.AddEvent(@event, DateTime.UtcNow.AddMinutes(25), "e1"); // this will replace the event just added
      Assert.IsTrue(repo.GetEvents().Count() == 2, "Failed to add event with same eventKey");
      manager.AddEvent(@event, DateTime.UtcNow.AddMinutes(26));
      Assert.IsTrue(repo.GetEvents().Count() == 3, "Failed to add new event of same object");
      
    }
예제 #2
0
    public void GetEventsTest()
    {
      var manager = new EventManager();
      IEventRepository repo = new MockEventRepository();
      manager.EventRepository = repo;

      manager.AddEvent(new TestEvent(), DateTime.Now);
      manager.AddEvent(new TestEvent(), DateTime.UtcNow.AddMinutes(15));
      Assert.IsTrue(repo.GetEvents().Count() == 2, "Expected 2 events");
    }