Exemple #1
0
        public void SendPackageViaWebAsyncFail()
        {
            var server = new ServerConfiguration
            {
                UseGibraltarService = true,
                CustomerName        = "BogusNonexistantCustomer"
            };

            using (Packager newPackager = new Packager())
            {
                m_EndSendReceived    = false;
                m_EndSendResult      = null;
                newPackager.EndSend += Packager_EndSend;
                newPackager.SendToServer(SessionCriteria.AllSessions, false, false, true, server);

                while (m_EndSendReceived == false)
                {
                    Thread.Sleep(16);
                }
                newPackager.EndSend -= Packager_EndSend;

                //we better have gotten a fail from the end sent result.
                Assert.IsNotNull(m_EndSendResult);
                Assert.IsTrue(m_EndSendResult.Result == AsyncTaskResult.Error);
            }
            m_EndSendReceived = false;
            m_EndSendResult   = null;
        }
        /// <summary>
        /// Perform the actual package transport
        /// </summary>
        /// <param name="progressMonitors"></param>
        /// <returns></returns>
        public void Send(ProgressMonitorStack progressMonitors)
        {
            Status = OnSend(progressMonitors);
#if DEBUG
            Debug.Assert(Status != null);
#endif
        }
Exemple #3
0
        public void SendPackageViaWebAsyncFail()
        {
            using (Packager newPackager = new Packager())
            {
                m_EndSendReceived    = false;
                m_EndSendResult      = null;
                newPackager.EndSend += Packager_EndSend;
                newPackager.SendToServer(SessionCriteria.AllSessions, false, false, true, true, "BogusNonexistantCustomer", null, 0, false, null, null, true);

                while (m_EndSendReceived == false)
                {
                    Thread.Sleep(16);
                }
                newPackager.EndSend -= Packager_EndSend;

                //we better have gotten a fail from the end sent result.
                Assert.IsNotNull(m_EndSendResult);
                Assert.IsTrue(m_EndSendResult.Result == AsyncTaskResult.Error);
            }
            m_EndSendReceived = false;
            m_EndSendResult   = null;
        }
Exemple #4
0
 /// <summary>
 /// 触发重新发送事件
 /// </summary>
 /// <param name="client">引发此事件的源对象</param>
 /// <param name="e">包含事件的参数</param>
 internal static void OnUdpPackageResend(IPMClient client, PackageSendEventArgs e)
 {
     SendOrPostCallback(false, UdpPackageResend, client, e);
 }
Exemple #5
0
 private void Packager_EndSend(object sender, PackageSendEventArgs args)
 {
     m_EndSendReceived = true;
     m_EndSendResult   = args;
 }