當前位置: 首頁>>代碼示例>>C#>>正文


C# Message.GetSessionID方法代碼示例

本文整理匯總了C#中QuickFix.Message.GetSessionID方法的典型用法代碼示例。如果您正苦於以下問題:C# Message.GetSessionID方法的具體用法?C# Message.GetSessionID怎麽用?C# Message.GetSessionID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在QuickFix.Message的用法示例。


在下文中一共展示了Message.GetSessionID方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SendToTarget

 /// <summary>
 /// Send to session indicated by header fields in message
 /// </summary>
 /// <param name="message"></param>
 /// <returns></returns>
 public static bool SendToTarget(Message message)
 {
     SessionID sessionID = message.GetSessionID(message);
     return SendToTarget(message, sessionID);
 }
開發者ID:thomasfleming,項目名稱:quickfixn,代碼行數:10,代碼來源:Session.cs

示例2: TestGetSetSessionID

        public void TestGetSetSessionID()
        {
            SessionID sessionID = new SessionID("FIX.4.2", "SENDER", "SENDERSUB", "SENDERLOC", "TARGET", "TARGETSUB", "TARGETLOC");
            Message msg = new Message();

            msg.SetSessionID(sessionID);

            Assert.That(msg.Header.GetString(Tags.BeginString), Is.EqualTo("FIX.4.2"));
            Assert.That(msg.Header.GetString(Tags.SenderCompID), Is.EqualTo("SENDER"));
            Assert.That(msg.Header.GetString(Tags.SenderSubID), Is.EqualTo("SENDERSUB"));
            Assert.That(msg.Header.GetString(Tags.SenderLocationID), Is.EqualTo("SENDERLOC"));
            Assert.That(msg.Header.GetString(Tags.TargetCompID), Is.EqualTo("TARGET"));
            Assert.That(msg.Header.GetString(Tags.TargetSubID), Is.EqualTo("TARGETSUB"));
            Assert.That(msg.Header.GetString(Tags.TargetLocationID), Is.EqualTo("TARGETLOC"));

            SessionID getSessionID = msg.GetSessionID(msg);
            Assert.That(getSessionID.BeginString, Is.EqualTo("FIX.4.2"));
            Assert.That(getSessionID.SenderCompID, Is.EqualTo("SENDER"));
            Assert.That(getSessionID.SenderSubID, Is.EqualTo("SENDERSUB"));
            Assert.That(getSessionID.SenderLocationID, Is.EqualTo("SENDERLOC"));
            Assert.That(getSessionID.TargetCompID, Is.EqualTo("TARGET"));
            Assert.That(getSessionID.TargetSubID, Is.EqualTo("TARGETSUB"));
            Assert.That(getSessionID.TargetLocationID, Is.EqualTo("TARGETLOC"));

            ////
            sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET");
            msg = new Message();

            msg.SetSessionID(sessionID);

            Assert.That(msg.Header.GetString(Tags.BeginString), Is.EqualTo("FIX.4.2"));
            Assert.That(msg.Header.GetString(Tags.SenderCompID), Is.EqualTo("SENDER"));
            Assert.That(msg.Header.IsSetField(Tags.SenderSubID), Is.False);
            Assert.That(msg.Header.IsSetField(Tags.SenderLocationID), Is.False);
            Assert.That(msg.Header.GetString(Tags.TargetCompID), Is.EqualTo("TARGET"));
            Assert.That(msg.Header.IsSetField(Tags.TargetSubID), Is.False);
            Assert.That(msg.Header.IsSetField(Tags.TargetLocationID), Is.False);

            getSessionID = msg.GetSessionID(msg);
            Assert.That(getSessionID.BeginString, Is.EqualTo("FIX.4.2"));
            Assert.That(getSessionID.SenderCompID, Is.EqualTo("SENDER"));
            Assert.That(getSessionID.SenderSubID, Is.EqualTo(""));
            Assert.That(getSessionID.SenderLocationID, Is.EqualTo(""));
            Assert.That(getSessionID.TargetCompID, Is.EqualTo("TARGET"));
            Assert.That(getSessionID.TargetSubID, Is.EqualTo(""));
            Assert.That(getSessionID.TargetLocationID, Is.EqualTo(""));
        }
開發者ID:RemiGaudin,項目名稱:quickfixn,代碼行數:47,代碼來源:MessageTests.cs


注:本文中的QuickFix.Message.GetSessionID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。