コード例 #1
0
        public void DeadmanAction_UnitTest()
        {
            TimeSpan time   = default(TimeSpan);
            Action   action = default(Action);

            TaskHelpers.DeadmanHandle _retVal = default(TaskHelpers.DeadmanHandle);
            ExecuteMethod(
                () =>
            {
                time   = default(TimeSpan);   //No Constructor
                action = default(Action);     //No Constructor
                DeadmanAction_PreCondition(ref time, ref action);
            },
                () => { _retVal = TaskHelpers.DeadmanAction(time, action); },
                () => { DeadmanAction_PostValidate(time, action, _retVal); });
        }
コード例 #2
0
        /// <summary>
        ///     Creates the client.
        /// </summary>
        private void CreateClient()
        {
            lock (r_SyncRoot)
            {
                if (m_Client == null)
                {
                    m_Client = new HttpClientLive();
                    m_Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    Fire_OnClientCreated(m_Client);

                    m_Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic",
                                                                                                 Convert.ToBase64String(
                                                                                                     Encoding.ASCII.GetBytes(string.Format("{0}:{1}", BasicAuthorizationUsername, BasicAuthorizationPassword))));

                    m_Deadman = TaskHelpers.DeadmanAction(TimeSpan.FromMilliseconds(1000), FreeClient);
                }
            }
        }