public void NoSameEventNameTest()
        {
            var provider1 = new TestEventsProvider();
            var provider2 = new TestEventsProvider2();

            CherryEventsCollection eventsCollection = new CherryEventsCollection();
            eventsCollection.AddProvider(provider1);
            Assert.Throws<PluginException>(() => eventsCollection.AddProvider(provider1));
            Assert.Throws<PluginException>(() => eventsCollection.AddProvider(provider2));

            CherryEventsCollection eventsCollection2 = new CherryEventsCollection();
            eventsCollection2.AddProvider(provider2);
            Assert.Throws<PluginException>(() => eventsCollection.AddProvider(provider1));
        }
        public void EventsCollectionSimpleTest()
        {
            bool firstFired = false;
            bool secondFired = false;

            var eventsProvider = new TestEventsProvider();
            CherryEventsCollection eventsCollection = new CherryEventsCollection();
            eventsCollection.AddProvider(eventsProvider);

            bool subscribeResult;

            var listener1 = new CherryEventListener(
                eventName1,
                ea => firstFired = true);
            subscribeResult = eventsCollection.Subscribe(listener1);
            Assert.IsTrue(subscribeResult);

            var listener2 = new CherryEventListener(
                eventName2,
                ea => secondFired = true);
            subscribeResult = eventsCollection.Subscribe(listener2);
            Assert.IsTrue(subscribeResult);

            subscribeResult = eventsCollection.Subscribe(listener2);
            Assert.IsFalse(subscribeResult);

            Assert.IsFalse(firstFired);
            Assert.IsFalse(secondFired);

            eventsProvider.FireSecond();
            Assert.IsFalse(firstFired);
            Assert.IsTrue(secondFired);

            eventsProvider.FireFirst();
            Assert.IsTrue(firstFired);
            Assert.IsTrue(secondFired);
        }