I am trying to write a test and need to create a Message
object with the IsFault
property set to true. However, this property only has a getter. Does anyone know the best way to create a message where this property would be set to true?
Thanks
I am trying to write a test and need to create a Message
object with the IsFault
property set to true. However, this property only has a getter. Does anyone know the best way to create a message where this property would be set to true?
Thanks
Possibly think about making a setter on the object with a proteced, internal or protected internal scope on. i.e.
public String MyProperty {get; internal set;}
Andrew
Reflection is another route, but I would think the first solution should work.
Andrew
Use the Message.CreateMessage()
overload that accepts a MessageFault
object. Something like the following should work.
Message CreateMessage()
{
return Message.CreateMessage(
MessageVersion.Default,
MessageFault.CreateFault(new FaultCode("fault-string"), "reason"),
"action-string");
}