I have a WCF service which uses HTTP+SSL for authentication. I am now writing integration tests (Visual Studio 2012 Unit Test Projects) that instance the actual service class and make calls.
The problem occurs in this first line in the WCF service method:
var userName = ServiceSecurityContext.Current.PrimaryIdentity.Name;
Because the unit test project is not making the call over HTTP.
Can anyone recommend a way to mock/stub the context so authentication will work?
Thanks.
I was able to get this working with Telerik JustMock. I started down the Castle road but did not have as much luck.
Anyway, for future posterity: