public ApplicationInfo(string applicationKey, string applicationPath, int siteId, string applicationPoolName, ApplicationPoolStates applicationPoolState, ApplicationRequestsBlockedStates requestsBlockedState, Uri messagePublicationNotificationServiceUri, Func<int> channelIdFactory)
 {
     CreationTime = DateTimeOffset.Now;
     _requestsBlockedState = requestsBlockedState;
     ApplicationKey = applicationKey;
     ApplicationPath = applicationPath;
     ApplicationPoolName = applicationPoolName;
     ApplicationPoolState = applicationPoolState;
     ListenerChannelSetup = new ListenerChannelSetup(applicationKey, applicationPath, messagePublicationNotificationServiceUri);
     ListenerChannelId = new Lazy<int>(channelIdFactory);
     SiteId = siteId;
     CanOpenNewListenerChannelInstance = true;
 }
 private IListenerChannelCallback CreateListenerChannelCallback(int listenerChannelId, string applicationId)
 {
     var setup = new ListenerChannelSetup(applicationId, Guid.NewGuid().ToString(), new Uri($"net.pipe://localhost/{Guid.NewGuid():N}"));
     var blob = setup.ToBytes();
     var callback = Substitute.For<IListenerChannelCallback>();
     var bufferSize = 0;
     callback.GetId().Returns(listenerChannelId);
     callback.GetBlobLength().Returns(blob.Length);
     callback.WhenForAnyArgs(x => x.GetBlob(null, ref bufferSize)).Do(x =>
     {
         Array.Copy(blob, x.ArgAt<Array>(0), blob.Length);
         x[1] = blob.Length;
     });
     return callback;
 }