diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-10-10 13:31:39 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-10-10 13:31:39 (GMT) |
commit | 29e4e51e21b8902c82456cc85af46fa5f5889f04 (patch) | |
tree | 5ad1d62b82effb59d46d92a272b3ebe998ce6e08 /Swiften/Queries/UnitTest | |
parent | fb7fe3dd7cf48b0e4a7337212129520dff5a236d (diff) | |
download | swift-29e4e51e21b8902c82456cc85af46fa5f5889f04.zip swift-29e4e51e21b8902c82456cc85af46fa5f5889f04.tar.bz2 |
Refactor responders to only start on start().
Diffstat (limited to 'Swiften/Queries/UnitTest')
-rw-r--r-- | Swiften/Queries/UnitTest/ResponderTest.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Swiften/Queries/UnitTest/ResponderTest.cpp b/Swiften/Queries/UnitTest/ResponderTest.cpp index 513c6ac..9824c98 100644 --- a/Swiften/Queries/UnitTest/ResponderTest.cpp +++ b/Swiften/Queries/UnitTest/ResponderTest.cpp @@ -20,6 +20,8 @@ class ResponderTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(ResponderTest); CPPUNIT_TEST(testConstructor); + CPPUNIT_TEST(testStart); + CPPUNIT_TEST(testStop); CPPUNIT_TEST(testHandleIQ_Set); CPPUNIT_TEST(testHandleIQ_Get); CPPUNIT_TEST(testHandleIQ_Error); @@ -46,9 +48,28 @@ class ResponderTest : public CppUnit::TestFixture channel_->onIQReceived(createRequest(IQ::Set)); + CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(testling.setPayloads_.size())); + } + + void testStart() { + MyResponder testling(router_); + + testling.start(); + channel_->onIQReceived(createRequest(IQ::Set)); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(testling.setPayloads_.size())); } + void testStop() { + MyResponder testling(router_); + + testling.start(); + testling.stop(); + channel_->onIQReceived(createRequest(IQ::Set)); + + CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(testling.setPayloads_.size())); + } + void testHandleIQ_Set() { MyResponder testling(router_); |