forked from Abc-Arbitrage/Disruptor-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAggregateEventHandlerTests.cpp
More file actions
56 lines (40 loc) · 1.8 KB
/
Copy pathAggregateEventHandlerTests.cpp
File metadata and controls
56 lines (40 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "stdafx.h"
#include "Disruptor/AggregateEventHandler.h"
#include "AggregateEventHandlerTestsFixture.h"
#include "SequencerFixture.h"
using namespace Disruptor;
using namespace Disruptor::Tests;
BOOST_AUTO_TEST_SUITE(AggregateEventHandlerTests)
BOOST_FIXTURE_TEST_CASE(ShouldCallOnEventInSequence, AggregateEventHandlerTestsFixture)
{
auto evt = 7;
const std::int64_t sequence = 3;
const auto endOfBatch = true;
EXPECT_CALL(*m_eventHandlerMock1, onEvent(evt, sequence, endOfBatch)).Times(1);
EXPECT_CALL(*m_eventHandlerMock2, onEvent(evt, sequence, endOfBatch)).Times(1);
EXPECT_CALL(*m_eventHandlerMock3, onEvent(evt, sequence, endOfBatch)).Times(1);
m_aggregateEventHandler->onEvent(evt, sequence, endOfBatch);
}
BOOST_FIXTURE_TEST_CASE(ShouldCallOnStartInSequence, AggregateEventHandlerTestsFixture)
{
EXPECT_CALL(*m_eventHandlerMock1, onStart()).Times(1);
EXPECT_CALL(*m_eventHandlerMock2, onStart()).Times(1);
EXPECT_CALL(*m_eventHandlerMock3, onStart()).Times(1);
m_aggregateEventHandler->onStart();
}
BOOST_FIXTURE_TEST_CASE(ShouldCallOnShutdownInSequence, AggregateEventHandlerTestsFixture)
{
EXPECT_CALL(*m_eventHandlerMock1, onShutdown()).Times(1);
EXPECT_CALL(*m_eventHandlerMock2, onShutdown()).Times(1);
EXPECT_CALL(*m_eventHandlerMock3, onShutdown()).Times(1);
m_aggregateEventHandler->onShutdown();
}
BOOST_FIXTURE_TEST_CASE(ShouldHandleEmptyListOfEventHandlers, AggregateEventHandlerTestsFixture)
{
auto newAggregateEventHandler = std::make_shared< AggregateEventHandler< std::int32_t > >();
auto v = 7;
BOOST_CHECK_NO_THROW(newAggregateEventHandler->onEvent(v, 0, true));
BOOST_CHECK_NO_THROW(newAggregateEventHandler->onStart());
BOOST_CHECK_NO_THROW(newAggregateEventHandler->onShutdown());
}
BOOST_AUTO_TEST_SUITE_END()