FIX: Fixes test_Service by replacing == expression with =.

This commit is contained in:
Christina Sander 2023-07-31 14:54:28 +02:00
parent 62022e668a
commit f3a46ef218
Signed by: csander
GPG Key ID: BBFE9B7C35D7363D

View File

@ -36,16 +36,14 @@ SCENARIO("Constructing two services that send and receive messages.","[Service]"
std::string testTopic = "testTopic"; std::string testTopic = "testTopic";
std::shared_ptr<WhisperCom::Service> serviceSource = nullptr; std::shared_ptr<WhisperCom::Service> serviceSource = nullptr;
REQUIRE_NOTHROW( serviceSource == std::make_shared<WhisperCom::Service>() ); REQUIRE_NOTHROW( serviceSource = std::make_shared<WhisperCom::Service>() );
REQUIRE( serviceSource != nullptr ); REQUIRE( serviceSource != nullptr );
serviceSource->subscribe( testTopic ); serviceSource->subscribe( testTopic );
std::this_thread::sleep_for( 2000ms );
std::shared_ptr<WhisperCom::Service> serviceSink = nullptr; std::shared_ptr<WhisperCom::Service> serviceSink = nullptr;
REQUIRE_NOTHROW( serviceSink == std::make_shared<WhisperCom::Service>() ); REQUIRE_NOTHROW( serviceSink = std::make_shared<WhisperCom::Service>() );
REQUIRE( serviceSink != nullptr ); REQUIRE( serviceSink != nullptr );
serviceSink->subscribe( testTopic ); serviceSink->subscribe( testTopic );
std::this_thread::sleep_for( 2000ms );
WHEN("Sending a message") WHEN("Sending a message")
{ {
@ -54,17 +52,15 @@ SCENARIO("Constructing two services that send and receive messages.","[Service]"
WhisperCom::Protobuf::Message wmsg{}; WhisperCom::Protobuf::Message wmsg{};
wmsg.mutable_payload()->PackFrom( msg ); wmsg.mutable_payload()->PackFrom( msg );
serviceSource->sendMessage( "test", wmsg ); serviceSource->sendMessage( "test", wmsg );
std::this_thread::sleep_for( 200ms ); std::this_thread::sleep_for( 400ms );
THEN("The sink service should receive the message") THEN("The sink service should receive the message")
{ {
CHECK( serviceSink->hasMessages() ); CHECK( serviceSink->hasMessages() );
std::this_thread::sleep_for( 6000ms );
} //THEN } //THEN
} // WHEN } // WHEN
serviceSource->stop(); serviceSource->stop();
std::this_thread::sleep_for( 2000ms );
serviceSink->stop(); serviceSink->stop();
} // GIVEN } // GIVEN
} //SCENARIO } //SCENARIO