コード例 #1
0
        public void test_isRTBarMergeNeed()
        {
            DateTime  afterSetTime            = new DateTime(2015, 11, 21, 9, 15, 55, DateTimeKind.Local);
            DateTime  afterSetTime2           = new DateTime(2015, 11, 21, 9, 16, 0, DateTimeKind.Local);
            DateTime  beforeSetTime           = new DateTime(2015, 11, 21, 9, 10, 55, DateTimeKind.Local);
            DateTime  beforeSetTime2          = new DateTime(2015, 11, 21, 9, 11, 0, DateTimeKind.Local);
            IBMessage afterSetTimeMessage     = createTimeMessage(afterSetTime);
            IBMessage beforeSetTimeMessage    = createTimeMessage(beforeSetTime);
            IBMessage afterSetTimeMessage2    = createTimeMessage(afterSetTime2);
            IBMessage beforeSetTimeMessage2   = createTimeMessage(beforeSetTime2);
            String    strTickerStartTimeOfDay = "09:15:00";

            //[Test : method return true, message time equal to RtbDataStartTime]
            IAppMDManager      appMDManager = getAppRTBSynchronizer_for_isRTBarMergeNeed(afterSetTime);
            AppRTBSynchronizer synchronizer = new AppRTBSynchronizer(appMDManager);

            //IAppRTBSynchronizer synchronizer = appMDManager.getAppRTBSynchronizer();
            Assert.AreEqual(true, synchronizer.isRTBarMergeNeed(strTickerStartTimeOfDay));

            //[Test : method return true, message time later than RtbDataStartTime]
            appMDManager = getAppRTBSynchronizer_for_isRTBarMergeNeed(afterSetTime);
            synchronizer = new AppRTBSynchronizer(appMDManager);
            Assert.AreEqual(true, synchronizer.isRTBarMergeNeed(strTickerStartTimeOfDay));

            //[Test : method return false, RtbDataStartTime before the strTickerStartTimeOfDay]
            appMDManager = getAppRTBSynchronizer_for_isRTBarMergeNeed(beforeSetTime);
            synchronizer = new AppRTBSynchronizer(appMDManager);
            Assert.AreEqual(false, synchronizer.isRTBarMergeNeed(strTickerStartTimeOfDay));

            //[Test : method return false, RtbDataStartTime before the strTickerStartTimeOfDay]
            appMDManager = getAppRTBSynchronizer_for_isRTBarMergeNeed(beforeSetTime);
            synchronizer = new AppRTBSynchronizer(appMDManager);
            Assert.AreEqual(false, synchronizer.isRTBarMergeNeed(strTickerStartTimeOfDay));
        }
コード例 #2
0
        public void test_reqHistDataIfValid()
        {
            //[Test : Request Hist Data valid, needMergeFlag is true, isReqHistDataSent is false, current message time is after the hist data send time]
            DateTime           processStartTime = new DateTime(2015, 10, 21, 10, 15, 0, DateTimeKind.Local);
            IAppMDManager      appMDManager     = getAppRTBSynchronizer_for_reqHistDataIfValid(processStartTime);
            AppRTBSynchronizer synchronizer     = new AppRTBSynchronizer(appMDManager);

            synchronizer.setNeedMergeFlag(true);
            synchronizer.setIsReqHistDataSent(false);
            DateTime validStartTime = new DateTime(2015, 10, 21, 10, 15, 35, DateTimeKind.Local);

            //Console.Write(""+ synchronizer.);
            synchronizer.reqHistDataIfValid(validStartTime, "MIDPOINT", null);
            Assert.IsTrue(synchronizer.getIsReqHistDataSent());

            //[Test : Request Hist Data not valid, needMergeFlag is true, isReqHistDataSent is false, current message time is before the hist data send time]
            appMDManager = getAppRTBSynchronizer_for_reqHistDataIfValid(processStartTime);
            synchronizer = new AppRTBSynchronizer(appMDManager);
            synchronizer.setNeedMergeFlag(true);
            synchronizer.setIsReqHistDataSent(false);
            DateTime invalidStartTime = new DateTime(2015, 10, 21, 10, 15, 25, DateTimeKind.Local);

            synchronizer.reqHistDataIfValid(invalidStartTime, "MIDPOINT", null);
            Assert.IsFalse(synchronizer.getIsReqHistDataSent());
        }