I want to mock ServiceContract. The problem is that Moq (and Dynamic-Proxy Castle) copies attributes from the interface to a dynamic proxy server that Wcf doesn't like. Wcf says: the ServiceContractAttribute attribute should only be defined for an interface or implementation, not both.
Exception: InvalidOperationException. The class of service is Castle.Proxies.IWorkOrderRequestServiceProxy and defines a ServiceContract and inherits ServiceContract from the IWorkOrderRequestService type. Contract inheritance can only be used between interface types. If a class is labeled ServiceContractAttribute, it must be the only type in the hierarchy with ServiceContractAttribute. Try moving the ServiceContractAttribute attribute to the IWorkOrderRequestService type on a separate interface, the IWorkOrderRequestService type implements
moq wcf
Michael
source share