I am trying to write unit tests for a custom ServiceAuthorizationManager. The call to CheckAccessCore takes an OperationContext parameter as a parameter. To create an instance of OperationContext, you must pass the IContextChannel to the constructor. Using MOQ, I declared IContextChannel:
private OperationContext _context; private Mock<IContextChannel> _contextChannelMock;
Then I try to create an OperationContext:
_context = new OperationContext(_contextChannelMock.Object);
But this line throws an exception:
Return message: The initialization method Urs.EnterpriseServices.Providers.Tests.UrsServiceAuthorizationManager_Tests.SetUp threw an exception. System.InvalidOperationException: System.InvalidOperationException: Invalid IContextChannel passed to OperationContext. There must be either a server control channel or a client proxy channel ..
How do I make fun of a dispatch channel server?
Steve source share