For my unit tests I need to set name and serviceName to my message. I need to create a message and then pass it to my OmmConsumerClient class. But it did not work.
After multiple attempts to make my code work, I finally realised that the issue is in particular logic of setting serviceName. When setting serviceName message, using the function with corresponding name, hasServiceName function always returns false.
I have checked the official unit tests and it appears that they specifically check that serviceName is not set even after it was set few lines above.
For example, official unit-tests of RefreshMsg - Real-Time-SDK/Cpp-C/Ema/Examples/Test/UnitTest/RefreshMsgTests.cpp at master · Refinitiv/Real-Time-SDK · GitHub :
//serviceName is only kept on the encoded RsslMsg
refresh.serviceName( serviceName );
// Other code...
EXPECT_FALSE( refresh.hasServiceName() ) << "RefreshMsg::hasServiceName() == false" ;
I have digged deeper into the code of internal encoders and decoders. There is a serviceId field which actually can be set.
Could somebody help me with writing a unit-test ? Comment above in the code states that serviceName is only kept on the encoded RsslMsg. How can I achieve a proper RefreshMsg object with name and serviceName set ?
Also, I am curious why such behavior was chosen ?