How to write an unit test for WCF behaviors?
- by katie77
I am new to unit testing.
How do I write a unit test for a method when I am extending a WCF behavior. Since I am not sure of when the class is being instantiated, or I can not change the method signature. In the behavior implementation, I am getting the header and looking up a value in the config.
public class IncomingValidator : IDispatchMessageInspector
{
public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
{
// Grab the header and see if one of the particular values(read from config) is there.
}
public void BeforeSendReply(ref Message reply, object correlationState)
{
}
}