项目作者: renestein

项目描述 :
Simple event aggregator (messenger) based on RxCpp
高级语言: C++
项目地址: git://github.com/renestein/RxEventAggregator.git
创建时间: 2018-06-08T12:32:42Z
项目社区:https://github.com/renestein/RxEventAggregator

开源协议:

下载


RxEventAggregator

Simple event aggregator (messenger) based on RxCpp (https://github.com/ReactiveX/RxCpp).
Backup of the repository https://bitbucket.org/renestein/rxeventaggregator/src/master/

  1. TEST(EventAggregatorTest, Publish_When_More_Events_Published_Then_Observer_Handles_All_Subscribed_Events)
  2. {
  3. const int EXPECTED_EVENTS = 10;
  4. EventAggregator<Event> aggregator;
  5. auto events = aggregator.GetEventStream<TestEvent>();
  6. int handledEventCount = 0;
  7. auto subscription = events.subscribe([&handledEventCount](auto _)
  8. {
  9. handledEventCount++;
  10. });
  11. for (auto i = 0; i < EXPECTED_EVENTS; i++)
  12. {
  13. aggregator.PublishEvent(make_shared<TestEvent>());
  14. aggregator.PublishEvent(make_shared<SpecialTestEvent>());
  15. }
  16. ASSERT_EQ(handledEventCount, EXPECTED_EVENTS);
  17. }