TEST(ClientNetworkManager, CanProcessMultipleMessagesInOneUpdate)
		{
			REGISTER_MESSAGE(MockMessage);

			unsigned numberOfExecutions = 0;
			MockMessage::setExecuteOnClientCommand([&](){numberOfExecutions++; });

			serverManager->sendMessage(MockMessage(), clientAddress1);
			serverManager->sendMessage(MockMessage(), clientAddress1);

			clientManager1->update();

			CHECK_EQUAL(2, numberOfExecutions);
		}
Пример #2
0
	int Send(uint8_t* data, size_t length) {
		MockMessage m = MockMessage(data, length);

		_send_queue.push(m);

		return length;
	}
Пример #3
0
	int PutReceive(uint8_t* data, size_t length) {
		MockMessage m = MockMessage(data, length);

		_receive_queue.push(m);

		return length;
	}
		TEST(ClientNetworkManager, DoesNotCallExecuteOnServerMethodInClient)
		{
			bool isMessageExecuted = false;

			REGISTER_MESSAGE(MockMessage);
			MockMessage::setExecuteOnServerCommand([&](){isMessageExecuted = true; });

			clientManager1->sendMessage(MockMessage(), network::InternetAddress(clientAddress1));
			serverManager->update();

			CHECK_FALSE(isMessageExecuted);
		}
		TEST(ClientNetworkManager, DoesNotCallNotRegisteredMessage)
		{
			//REGISTER_MESSAGE(MockMessage);
			bool isMessageExecuted = false;

			MockMessage::setExecuteOnClientCommand([&](){isMessageExecuted = true; });

			serverManager->sendMessage(MockMessage(), clientAddress1);

			clientManager1->update();

			CHECK_FALSE(isMessageExecuted);
		}