コード例 #1
0
        /// <summary>
        /// Constructor of SutControlProxy, used in unit test
        /// or in case caller has obtained an ISutControlService instance.
        /// </summary>
        /// <param name="service">service that implemented ISutControlService interface.</param>
        /// <exception cref="ArgumentNullException">service is null</exception>
        public SutControlProxy(ISutControlService service)
        {
            InitializeLogger();

            #region assert
            AssertIsNotNull("service", service);
            #endregion

            this.service = service;
        }
コード例 #2
0
        /// <summary>
        /// Constructor of SutControlProxy.
        /// </summary>
        /// <param name="sutAddress">the address of the SUT,
        /// can be either IP address or computer name.
        /// </param>
        /// <param name="port">the port on SUT machine to provide SUT control service.</param>
        /// <exception cref="ArgumentNullException">sutAddress is null</exception>
        public SutControlProxy(string sutAddress, uint port)
        {
            AssertIsNotNull("sutAddress", sutAddress);

            InitializeLogger();

            #region logging
            Info("Construct SutControlProxy, address={0}, port={1}.", sutAddress, port);
            #endregion

            // SUT control service address
            string          sutControlServiceAddress = string.Format(CultureInfo.InvariantCulture, ServiceAddressFormat, sutAddress, port);
            EndpointAddress endpointAddress          = new EndpointAddress(sutControlServiceAddress);

            // channel factory
            NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
            ChannelFactory <ISutControlService> factory = new ChannelFactory <ISutControlService>(binding);

            // create service channel
            service = factory.CreateChannel(endpointAddress);
        }
コード例 #3
0
        /// <summary>
        /// Constructor of SutControlProxy.
        /// </summary>
        /// <param name="sutAddress">the address of the SUT,
        /// can be either IP address or computer name.
        /// </param>
        /// <param name="port">the port on SUT machine to provide SUT control service.</param>
        /// <exception cref="ArgumentNullException">sutAddress is null</exception>
        public SutControlProxy(string sutAddress, uint port)
        {
            AssertIsNotNull("sutAddress", sutAddress);

            InitializeLogger();

            #region logging
            Info("Construct SutControlProxy, address={0}, port={1}.", sutAddress, port);
            #endregion

            // SUT control service address
            string sutControlServiceAddress = string.Format(CultureInfo.InvariantCulture, ServiceAddressFormat, sutAddress, port);
            EndpointAddress endpointAddress = new EndpointAddress(sutControlServiceAddress);

            // channel factory
            NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
            ChannelFactory<ISutControlService> factory = new ChannelFactory<ISutControlService>(binding);

            // create service channel
            service = factory.CreateChannel(endpointAddress);
        }
コード例 #4
0
        /// <summary>
        /// Constructor of SutControlProxy, used in unit test
        /// or in case caller has obtained an ISutControlService instance.
        /// </summary>
        /// <param name="service">service that implemented ISutControlService interface.</param>
        /// <exception cref="ArgumentNullException">service is null</exception>
        public SutControlProxy(ISutControlService service)
        {
            InitializeLogger();

            #region assert
            AssertIsNotNull("service", service);
            #endregion

            this.service = service;
        }