Exemple #1
0
        public void AbortEvents_DoesNothingWhenQueueIsEmpty()
        {
            var em = new EventManager();

            em.Initialize();
            em.PostInitialize();

            var result = em.AbortEvents <EventStub>();

            Assert.AreEqual(0, result);
            Assert.IsEmpty(em.PendingEvents);
        }
Exemple #2
0
        public void AbortEvents_ClearsMultipleEvents()
        {
            var em = new EventManager();

            em.Initialize();
            em.PostInitialize();
            em.QueueEvent(new EventStub());
            em.QueueEvent(new EventStub());

            var result = em.AbortEvents <EventStub>();

            Assert.AreEqual(2, result);
            Assert.IsEmpty(em.PendingEvents);
        }
Exemple #3
0
        public void AbortEvents_ClearsEventsOfCorrectType()
        {
            var em = new EventManager();

            em.Initialize();
            em.PostInitialize();
            em.QueueEvent(new EventStub());
            var @event = new EventStub2();

            em.QueueEvent(@event);
            em.QueueEvent(new EventStub());

            var result = em.AbortEvents <EventStub>();

            Assert.AreEqual(2, result);
            Assert.AreEqual(1, em.PendingEvents.Count);
            Assert.AreSame(@event, em.PendingEvents.First());
        }