本文整理汇总了C#中QuickFix.Dictionary.SetString方法的典型用法代码示例。如果您正苦于以下问题:C# QuickFix.Dictionary.SetString方法的具体用法?C# QuickFix.Dictionary.SetString怎么用?C# QuickFix.Dictionary.SetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuickFix.Dictionary
的用法示例。
在下文中一共展示了QuickFix.Dictionary.SetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testInvalidTimeZone
public void testInvalidTimeZone()
{
QuickFix.Dictionary settings = new QuickFix.Dictionary();
settings.SetString(QuickFix.SessionSettings.START_TIME, "06:00:23");
settings.SetString(QuickFix.SessionSettings.END_TIME, "00:12:00");
settings.SetString(QuickFix.SessionSettings.TIME_ZONE, "Doh");
Assert.Throws(typeof (TimeZoneNotFoundException), delegate { new QuickFix.SessionSchedule(settings); });
}
示例2: CreateConfig
private static QuickFix.Dictionary CreateConfig()
{
QuickFix.Dictionary config = new QuickFix.Dictionary();
config.SetBool(QuickFix.SessionSettings.PERSIST_MESSAGES, false);
config.SetString(QuickFix.SessionSettings.CONNECTION_TYPE, "initiator");
config.SetString(QuickFix.SessionSettings.START_TIME, "00:00:00");
config.SetString(QuickFix.SessionSettings.END_TIME, "00:00:00");
return config;
}
示例3: testLocalTimeTimeZoneConflict
public void testLocalTimeTimeZoneConflict()
{
QuickFix.Dictionary settings = new QuickFix.Dictionary();
settings.SetString(QuickFix.SessionSettings.START_TIME, "06:00:23");
settings.SetString(QuickFix.SessionSettings.END_TIME, "00:12:00");
settings.SetString(QuickFix.SessionSettings.TIME_ZONE, "Doh");
settings.SetString(QuickFix.SessionSettings.USE_LOCAL_TIME, "Y");
settings.SetString(QuickFix.SessionSettings.TIME_ZONE, "Eastern Standard Time");
Assert.Throws(typeof (QuickFix.ConfigError), delegate { new QuickFix.SessionSchedule(settings); });
}
示例4: testOptArgs
public void testOptArgs()
{
QuickFix.Dictionary settings = new QuickFix.Dictionary();
settings.SetString(QuickFix.SessionSettings.START_TIME, "00:00:00");
settings.SetString(QuickFix.SessionSettings.END_TIME, "00:00:00");
settings.SetDay(QuickFix.SessionSettings.START_DAY, System.DayOfWeek.Thursday);
Assert.Throws(typeof(QuickFix.ConfigError), delegate { new QuickFix.SessionSchedule(settings); });
settings.SetDay(QuickFix.SessionSettings.END_DAY, System.DayOfWeek.Friday);
Assert.DoesNotThrow(delegate { new QuickFix.SessionSchedule(settings); });
}
示例5: testDailyIsSessionTimeAllDay
public void testDailyIsSessionTimeAllDay()
{
QuickFix.Dictionary settings = new QuickFix.Dictionary();
settings.SetString(QuickFix.SessionSettings.START_TIME, "00:00:00");
settings.SetString(QuickFix.SessionSettings.END_TIME, "00:00:00");
QuickFix.SessionSchedule sched = new QuickFix.SessionSchedule(settings);
Assert.IsTrue(sched.IsSessionTime(new DateTime(2011,10,17,9,43,0)));
Assert.IsTrue(sched.IsSessionTime(new DateTime(2011,10,18,9,43,0)));
Assert.IsTrue(sched.IsSessionTime(new DateTime(2011, 10, 18, 0, 0, 0)));
Assert.IsTrue(sched.IsSessionTime(new DateTime(2011, 10, 18, 23, 59, 59)));
}
示例6: testRequiredArgs
public void testRequiredArgs()
{
QuickFix.Dictionary settings = new QuickFix.Dictionary();
Assert.Throws(typeof(QuickFix.ConfigError), delegate { new QuickFix.SessionSchedule(settings); });
settings.SetString(QuickFix.SessionSettings.START_TIME, "00:00:00");
Assert.Throws(typeof(QuickFix.ConfigError), delegate { new QuickFix.SessionSchedule(settings); });
settings.SetString(QuickFix.SessionSettings.END_TIME, "00:0blkajsdf");
Assert.Throws(typeof(QuickFix.ConfigError), delegate { new QuickFix.SessionSchedule(settings); });
settings.SetString(QuickFix.SessionSettings.END_TIME, "00:00:00");
Assert.DoesNotThrow(delegate { new QuickFix.SessionSchedule(settings); });
}
示例7: testDailyIsSessionTimeWrapAround
public void testDailyIsSessionTimeWrapAround()
{
QuickFix.Dictionary settings = new QuickFix.Dictionary();
settings.SetString(QuickFix.SessionSettings.START_TIME, "06:00:23");
settings.SetString(QuickFix.SessionSettings.END_TIME, "00:12:00");
QuickFix.SessionSchedule sched = new QuickFix.SessionSchedule(settings);
Assert.IsTrue(sched.IsSessionTime(new DateTime(2011, 10, 17, 6, 0, 23)));
Assert.IsTrue(sched.IsSessionTime(new DateTime(2011, 10, 17, 8, 43, 0)));
Assert.IsTrue(sched.IsSessionTime(new DateTime(2011, 10, 18, 0, 12, 00)));
Assert.IsFalse(sched.IsSessionTime(new DateTime(2011, 10, 18, 0, 12, 1)));
Assert.IsFalse(sched.IsSessionTime(new DateTime(2011, 10, 18, 6, 0, 22)));
}
示例8: testLogRotation
public void testLogRotation()
{
string logDir = "log";
if (System.IO.Directory.Exists(logDir))
System.IO.Directory.Delete(logDir, true);
QuickFix.SessionID sessionID = new QuickFix.SessionID("FIX.4.2", "SENDERCOMP", "TARGETCOMP");
QuickFix.SessionSettings settings = new QuickFix.SessionSettings();
QuickFix.Dictionary config = new QuickFix.Dictionary();
config.SetString(QuickFix.SessionSettings.CONNECTION_TYPE, "initiator");
config.SetString(QuickFix.SessionSettings.FILE_LOG_PATH, logDir);
int NumLogsToRotate = 5;
config.SetString(QuickFix.SessionSettings.FILE_LOG_ROTATE_NUM_TO_KEEP, NumLogsToRotate.ToString());
config.SetString(QuickFix.SessionSettings.FILE_LOG_ROTATE_ON_NEW_SESSION, "Y");
settings.Set(sessionID, config);
string timeStampMinute = System.DateTime.UtcNow.ToString("MMddyyyy-HHmm");
for (int i = 0; i < NumLogsToRotate; i++)
{
QuickFix.FileLogFactory factory = new QuickFix.FileLogFactory(settings);
log = (QuickFix.FileLog)factory.Create(sessionID);
log.OnEvent("some event");
log.OnIncoming("some incoming");
log.OnOutgoing("some outgoing");
Assert.That(System.IO.File.Exists(logDir+"/FIX.4.2-SENDERCOMP-TARGETCOMP.event.current.log"));
Assert.That(System.IO.File.Exists(logDir+"/FIX.4.2-SENDERCOMP-TARGETCOMP.messages.current.log"));
log.Dispose();
}
Assert.That(System.IO.Directory.GetFiles(logDir,
String.Format("FIX.4.2-SENDERCOMP-TARGETCOMP.messages.current.log.{0}*",timeStampMinute),
System.IO.SearchOption.TopDirectoryOnly)
.Count().Equals(NumLogsToRotate-1));
Assert.That(System.IO.Directory.GetFiles(logDir,
String.Format("FIX.4.2-SENDERCOMP-TARGETCOMP.event.current.log.{0}*", timeStampMinute),
System.IO.SearchOption.TopDirectoryOnly)
.Count().Equals(NumLogsToRotate-1));
}
示例9: setup
public void setup()
{
if (System.IO.Directory.Exists("store"))
System.IO.Directory.Delete("store", true);
sessionID = new QuickFix.SessionID("FIX.4.2", "SENDERCOMP", "TARGETCOMP");
QuickFix.Dictionary config = new QuickFix.Dictionary();
config.SetString(QuickFix.SessionSettings.CONNECTION_TYPE, "initiator");
config.SetString(QuickFix.SessionSettings.FILE_STORE_PATH, "store");
settings = new QuickFix.SessionSettings();
settings.Set(sessionID, config);
factory = new QuickFix.FileStoreFactory(settings);
store = (QuickFix.FileStore)factory.Create(sessionID);
}
示例10: testThrowsIfNoConfig
public void testThrowsIfNoConfig()
{
QuickFix.SessionID sessionID = new QuickFix.SessionID("FIX.4.2", "SENDERCOMP", "TARGETCOMP");
QuickFix.Dictionary config = new QuickFix.Dictionary();
config.SetString(QuickFix.SessionSettings.CONNECTION_TYPE, "initiator");
QuickFix.SessionSettings settings = new QuickFix.SessionSettings();
settings.Set(sessionID, config);
QuickFix.FileLogFactory factory = new QuickFix.FileLogFactory(settings);
Assert.Throws<QuickFix.ConfigError>(delegate { factory.Create(sessionID); });
}
示例11: testLastEndTime_DailySessions
public void testLastEndTime_DailySessions()
{
QuickFix.Dictionary settings = new QuickFix.Dictionary();
settings.SetString(QuickFix.SessionSettings.START_TIME, "09:30:00");
settings.SetString(QuickFix.SessionSettings.END_TIME, "16:00:00");
QuickFix.SessionSchedule sched = new QuickFix.SessionSchedule(settings);
DateTime thisDayEnd = new DateTime(2012, 10, 18, 16, 00, 00, DateTimeKind.Utc);
DateTime prevDayEnd = new DateTime(2012, 10, 17, 16, 00, 00, DateTimeKind.Utc);
// before starttime
Assert.AreEqual(prevDayEnd, sched.LastEndTime(new DateTime(2012, 10, 18, 08, 00, 00, DateTimeKind.Utc)));
// during session
Assert.AreEqual(prevDayEnd, sched.LastEndTime(new DateTime(2012, 10, 18, 08, 00, 00, DateTimeKind.Utc)));
// equals endtime
Assert.AreEqual(thisDayEnd, sched.LastEndTime(thisDayEnd));
// after endtime
Assert.AreEqual(thisDayEnd, sched.LastEndTime(new DateTime(2012, 10, 18, 17, 00, 00, DateTimeKind.Utc)));
// ==========
// Settings file is specified in a zone (est, -5)
settings = new QuickFix.Dictionary();
settings.SetString(QuickFix.SessionSettings.START_TIME, "04:30:00"); // 09:30:00 utc
settings.SetString(QuickFix.SessionSettings.END_TIME, "11:00:00"); // 16:00:00 utc
settings.SetString(QuickFix.SessionSettings.TIME_ZONE, "Eastern Standard Time"); //-5
sched = new QuickFix.SessionSchedule(settings);
// before starttime
Assert.AreEqual(prevDayEnd, sched.LastEndTime(new DateTime(2012, 10, 18, 08, 00, 00, DateTimeKind.Utc)));
// during session
Assert.AreEqual(prevDayEnd, sched.LastEndTime(new DateTime(2012, 10, 18, 10, 00, 00, DateTimeKind.Utc)));
// equals endtime
Assert.AreEqual(thisDayEnd, sched.LastEndTime(thisDayEnd));
// after endtime
Assert.AreEqual(thisDayEnd, sched.LastEndTime(new DateTime(2012, 10, 18, 17, 00, 00, DateTimeKind.Utc)));
}
示例12: testGeneratedFileName
public void testGeneratedFileName()
{
if (System.IO.Directory.Exists("log"))
System.IO.Directory.Delete("log", true);
QuickFix.SessionID sessionID = new QuickFix.SessionID("FIX.4.2", "SENDERCOMP", "TARGETCOMP");
QuickFix.SessionSettings settings = new QuickFix.SessionSettings();
QuickFix.Dictionary config = new QuickFix.Dictionary();
config.SetString(QuickFix.SessionSettings.CONNECTION_TYPE, "initiator");
config.SetString(QuickFix.SessionSettings.FILE_LOG_PATH, "log");
settings.Set(sessionID, config);
QuickFix.FileLogFactory factory = new QuickFix.FileLogFactory(settings);
log = (QuickFix.FileLog)factory.Create(sessionID);
log.OnEvent("some event");
log.OnIncoming("some incoming");
log.OnOutgoing("some outgoing");
Assert.That(System.IO.File.Exists("log/FIX.4.2-SENDERCOMP-TARGETCOMP.event.current.log"));
Assert.That(System.IO.File.Exists("log/FIX.4.2-SENDERCOMP-TARGETCOMP.messages.current.log"));
}
示例13: setup
public void setup()
{
responder = new MockResponder();
sessionID = new QuickFix.SessionID("FIX.4.2", "SENDER", "TARGET");
application = new MockApplication();
settings = new QuickFix.SessionSettings();
QuickFix.Dictionary config = new QuickFix.Dictionary();
config.SetBool(QuickFix.SessionSettings.PERSIST_MESSAGES, false);
config.SetString(QuickFix.SessionSettings.CONNECTION_TYPE, "initiator");
config.SetString(QuickFix.SessionSettings.START_TIME, "00:00:00");
config.SetString(QuickFix.SessionSettings.END_TIME, "00:00:00");
settings.Set(sessionID, config);
session = new QuickFix.Session(application, new QuickFix.MemoryStoreFactory(), sessionID,
new QuickFix.DataDictionaryProvider(),new QuickFix.SessionSchedule(config), 0, new QuickFix.ScreenLogFactory(settings), new QuickFix.DefaultMessageFactory(), "blah");
session.SetResponder(responder);
session.CheckLatency = false;
// must be set for an initiator
int heartBeatInterval = 10;
session2 = new QuickFix.Session(application, new QuickFix.MemoryStoreFactory(), new QuickFix.SessionID("FIX.4.2", "OTHER_SENDER", "OTHER_TARGET"),
new QuickFix.DataDictionaryProvider(), new QuickFix.SessionSchedule(config), heartBeatInterval, new QuickFix.ScreenLogFactory(settings), new QuickFix.DefaultMessageFactory(), "blah");
session2.SetResponder(responder);
session2.CheckLatency = false;
seqNum = 1;
}
示例14: testDailyIsSessionTime
public void testDailyIsSessionTime()
{
QuickFix.Dictionary settings = new QuickFix.Dictionary();
settings.SetString(QuickFix.SessionSettings.START_TIME, "00:12:00");
settings.SetString(QuickFix.SessionSettings.END_TIME, "06:00:23");
QuickFix.SessionSchedule sched = new QuickFix.SessionSchedule(settings);
Assert.IsTrue(sched.IsSessionTime(new DateTime(2011, 10, 17, 0, 12, 0, DateTimeKind.Utc)));
Assert.IsTrue(sched.IsSessionTime(new DateTime(2011, 10, 17, 5, 43, 0, DateTimeKind.Utc)));
Assert.IsTrue(sched.IsSessionTime(new DateTime(2011, 10, 18, 6, 0, 23, DateTimeKind.Utc)));
Assert.IsFalse(sched.IsSessionTime(new DateTime(2011, 10, 18, 0, 11, 0, DateTimeKind.Utc)));
Assert.IsFalse(sched.IsSessionTime(new DateTime(2011, 10, 18, 6, 0, 24, DateTimeKind.Utc)));
}
示例15: testWeeklySessionSameDayOneDay
public void testWeeklySessionSameDayOneDay()
{
QuickFix.Dictionary settings = new QuickFix.Dictionary();
settings.SetString(QuickFix.SessionSettings.START_TIME, "00:00:00");
settings.SetString(QuickFix.SessionSettings.END_TIME, "05:00:00");
settings.SetDay(QuickFix.SessionSettings.START_DAY, System.DayOfWeek.Monday);
settings.SetDay(QuickFix.SessionSettings.END_DAY, System.DayOfWeek.Monday);
QuickFix.SessionSchedule sched = new QuickFix.SessionSchedule(settings);
//a sunday
Assert.IsFalse(sched.IsSessionTime(new DateTime(2011, 10, 16, 23, 59, 59)));
Assert.IsFalse(sched.IsSessionTime(new DateTime(2011, 10, 16, 0, 0, 0)));
//a monday
Assert.IsTrue(sched.IsSessionTime(new DateTime(2011, 10, 17, 0, 0, 1)));
Assert.IsTrue(sched.IsSessionTime(new DateTime(2011, 10, 17, 4, 0, 1)));
Assert.IsFalse(sched.IsSessionTime(new DateTime(2011, 10, 17, 6, 59, 59)));
//a tuesday
Assert.IsFalse(sched.IsSessionTime(new DateTime(2011, 10, 18, 9, 43, 0)));
Assert.IsFalse(sched.IsSessionTime(new DateTime(2011, 10, 18, 0, 0, 0)));
}