private static AclBasedSecurityMessageHandler CreateSubjectUnderTest( HttpResponseMessage response, ISubscriberRepository subscriberRepository, bool forceAuthentication = false, Action <HttpRequestMessage, IPrincipal> assignPrincipalFactory = null) { IPrincipal principal; if (assignPrincipalFactory.IsNull()) { assignPrincipalFactory = (r, p) => principal = p; } var sut = new AclBasedSecurityMessageHandler(forceAuthentication); sut.InnerHandler = new TestHandler(response); sut.SetSubscriberRepositoryFactory( (config, request) => subscriberRepository ?? Mock.Of <ISubscriberRepository>()); sut.SetAssignPrincipalFactory(assignPrincipalFactory); return(sut); }
private static AclBasedSecurityMessageHandler CreateSubjectUnderTest( HttpResponseMessage response, ISubscriberRepository subscriberRepository, bool forceAuthentication = false, Action<HttpRequestMessage, IPrincipal> assignPrincipalFactory = null) { IPrincipal principal; if (assignPrincipalFactory.IsNull()) assignPrincipalFactory = (r, p) => principal = p; var sut = new AclBasedSecurityMessageHandler(forceAuthentication); sut.InnerHandler = new TestHandler(response); sut.SetSubscriberRepositoryFactory( (config, request) => subscriberRepository ?? Mock.Of<ISubscriberRepository>()); sut.SetAssignPrincipalFactory(assignPrincipalFactory); return sut; }