0
votes

I am writing Unit tests for a Service Fabric Reliable Service. My application is an OWIN hosted Stateless service, I want to write Unit test for Communication listener, Which uses ServiceInitializationParameters class. I can't initialize a dummy object of this type since all the fields are read only and no public constructor is available. For State in service fabric, We can mock it by using a mock class which implements an interface for state.

Is there any similar way to mock the Service Initialization Parameters ?

1
You can initialize it using reflectionAleksey L.

1 Answers

2
votes

Yeah you can't mock out ServiceInitializationParameters in the current release, but you will be able to in an upcoming release, so stay tuned for that.