void InitServiceHolders()
 {
     // access control
     _pacsServiceHolder = new ServiceHolder <PACSPortClient, PACSPort>(
         (features) => { return(DeviceClient.GetServiceAddress(OnvifService.ACCESSCONTROL)); },
         (binding, address) => { return(new PACSPortClient(binding, address)); },
         "Access Control");
 }
        void InitServiceClient(ServiceHolder serviceHolder, IEnumerable <IChannelController> controllers)
        {
            bool found = false;

            if (!serviceHolder.HasAddress)
            {
                RunStep(() =>
                {
                    serviceHolder.Retrieve(Features);
                    if (!serviceHolder.HasAddress)
                    {
                        throw new AssertException(string.Format("{0} service not found", serviceHolder.ServiceName));
                    }
                    else
                    {
                        found = true;
                        LogStepEvent(serviceHolder.Address);
                    }
                }, string.Format("Get {0} service address", serviceHolder.ServiceName),
                        OnvifFaults.NoSuchService, true, true);
                DoRequestDelay();
            }

            Assert(found,
                   string.Format("{0} service address not found", serviceHolder.ServiceName),
                   string.Format("Check that the DUT returned {0} service address", serviceHolder.ServiceName));

            if (found)
            {
                EndpointController controller = new EndpointController(new EndpointAddress(serviceHolder.Address));

                List <IChannelController> ctrls = new List <IChannelController>();
                ctrls.Add(controller);
                ctrls.AddRange(controllers);

                Binding binding = CreateBinding(
                    false,
                    ctrls);

                serviceHolder.CreateClient(binding, AttachSecurity, SetupChannel);
            }
        }