question

Upvotes
Accepted
3 1 2 7

Create OMMItemEvent and Data.FieldList - RFA.NET

I trying to make unit tests of my ProcessEvent in my Client class decentant as well as my DecodeMsg. And for that purpose I need to create test data

For ProcessEvent I need to create ThomsonReuters.RFA.SessionLayer.OMMItemEvent's to test my branches.

And for DecodeMsg I need to create ThomsonReuters.RFA.Data.FieldList as far as I can see. I thing I have figure a way to store the data but I can get the other way.

My basic problem is that I can find a way to create these classes and get them setup in RFA.NET


/Jens G

treprfarfa-api.net
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
25.3k 87 12 25

Hi @jens

As you may have noted from the RFA.net documentation, there are no constructor methods exposed for OmmItemEvent, OmmConnectionEvent etc.

That is why I suggested you connect your consumer to one of the Interactive Provider examples and modify the Provider source code to generate the events as required for your test scenarios.

This is the normal route RFA.Net developers take for testing their consumer applications.



icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
25.3k 87 12 25

Hi @jens

I am assuming you are developing a Consumer; a good way to test your consumer is to run an Interactive Provider example and connect the consumer directly to the provider. As we provide the source code for the Interactive Provider you can edit it to suit your testing requirements.

If you refer to the Examples folder you should find the StarterProvider_Interactive and the Provider_Interactive.

If you configure the IProvider to listen on the same port as your Consumer .e.g. 14002 the default and you set the serverList/hostName value to wherever the IProvider is running e.g. localhost - then the Consumer should connect directly to the Provider.

You can refer to the README.txt file in the individual example's folder for more detail.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
3 1 2 7

Well I already have programmed my consumer at it works like it should. But now I want to make unit test of the individual classes.

So now I have a method like this:

public void ProcessEvent(Event evnt)

{

if (evnt == null)

return;

switch (evnt.Type)

{

case SessionLayerEventTypeEnum.ConnectionEvent:

ProcessConnectionEvent(evnt as OMMConnectionEvent);

break;

case SessionLayerEventTypeEnum.OMMItemEvent:

ProcessOMMItemEvent(evnt as OMMItemEvent);

break;

default:

logHandler.LogWarning(string.Format("<- Received event with unknown event type: {0}", evnt.Type));

break;

}

}

And I wand to make a test of the method. I would do something like this

OMMConnectionEvent evnt = new OMMConnectionEvent();

// Setup event

rc.ProcessEvent(evnt );

Assert....

But my problem is that I can not figure out how to create OMMConnectionEvent or any other event for that matter to simulate event comming from the API.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.