void StamperTest::stamp() { // test if stamping works StamperTestCommand stamp; stamp.magic.postPaid = false; stamper->setStamp(stamp); wns::ldk::CompoundPtr compound; CPPUNIT_ASSERT_NO_THROW(compound = sendCompound(newFakeCompound())); CPPUNIT_ASSERT_EQUAL((unsigned int)1, compoundsSent()); StamperTestCommand* command = stamper->getCommand(compound->getCommandPool()); CPPUNIT_ASSERT(!command->magic.postPaid); // test if Stamper uses its own instance to stamp stamp.magic.postPaid = true; compound = sendCompound(newFakeCompound()); CPPUNIT_ASSERT_EQUAL((unsigned int)2, compoundsSent()); command = stamper->getCommand(compound->getCommandPool()); CPPUNIT_ASSERT(!command->magic.postPaid); // test if updating the stamp works stamper->setStamp(stamp); compound = sendCompound(newFakeCompound()); CPPUNIT_ASSERT_EQUAL((unsigned int)3, compoundsSent()); command = stamper->getCommand(compound->getCommandPool()); CPPUNIT_ASSERT(command->magic.postPaid); }
void FUTestBaseTest::counters() { CPPUNIT_ASSERT_EQUAL((unsigned int)0, compoundsAccepted()); CPPUNIT_ASSERT_EQUAL((unsigned int)0, compoundsSent()); CPPUNIT_ASSERT_EQUAL((unsigned int)0, compoundsReceived()); CPPUNIT_ASSERT_EQUAL((unsigned int)0, compoundsDelivered()); sendCompound(newFakeCompound()); CPPUNIT_ASSERT_EQUAL((unsigned int)1, compoundsAccepted()); CPPUNIT_ASSERT_EQUAL((unsigned int)1, compoundsSent()); CPPUNIT_ASSERT_EQUAL((unsigned int)0, compoundsReceived()); CPPUNIT_ASSERT_EQUAL((unsigned int)0, compoundsDelivered()); stub->close(); sendCompound(newFakeCompound()); stub->open(); CPPUNIT_ASSERT_EQUAL((unsigned int)2, compoundsAccepted()); CPPUNIT_ASSERT_EQUAL((unsigned int)1, compoundsSent()); CPPUNIT_ASSERT_EQUAL((unsigned int)0, compoundsReceived()); CPPUNIT_ASSERT_EQUAL((unsigned int)0, compoundsDelivered()); receiveCompound(sendCompound(newFakeCompound())); CPPUNIT_ASSERT_EQUAL((unsigned int)3, compoundsAccepted()); CPPUNIT_ASSERT_EQUAL((unsigned int)2, compoundsSent()); CPPUNIT_ASSERT_EQUAL((unsigned int)1, compoundsReceived()); CPPUNIT_ASSERT_EQUAL((unsigned int)1, compoundsDelivered()); }
void StamperTest::noStamp() { WNS_ASSERT_ASSURE_EXCEPTION(sendCompound(newFakeCompound())); }