示例#1
0
        public void InSessionReturnsFalseWhenAfterWeekSpanningDaySession()
        {
            var session = new InstrumentSession
            {
                OpeningDay = DayOfTheWeek.Sunday,
                ClosingDay = DayOfTheWeek.Monday,
                OpeningTime = new TimeSpan(15, 0, 0),
                ClosingTime = new TimeSpan(15, 0, 0)
            };

            //Tuesday, April 2
            var dt = new DateTime(2014, 4, 2, 13, 0, 0);

            Assert.IsFalse(dt.InSession(session));
        }
示例#2
0
        public void InSessionReturnsFalseWhenBeforeWeekSpanningDaySession()
        {
            var session = new InstrumentSession
            {
                OpeningDay = DayOfTheWeek.Sunday,
                ClosingDay = DayOfTheWeek.Monday,
                OpeningTime = new TimeSpan(15, 0, 0),
                ClosingTime = new TimeSpan(15, 0, 0)
            };

            //Sunday, March 30
            var dt = new DateTime(2014, 3, 30, 13, 0, 0);

            Assert.IsFalse(dt.InSession(session));
        }
示例#3
0
        public void InSessionReturnsTrueWhenInsideWeekSpanningSessionInSecondWeek()
        {
            var session = new InstrumentSession
            {
                OpeningDay = DayOfTheWeek.Sunday,
                ClosingDay = DayOfTheWeek.Monday,
                OpeningTime = new TimeSpan(15, 0, 0),
                ClosingTime = new TimeSpan(15, 0, 0)
            };

            //Monday, March 31
            var dt = new DateTime(2014, 3, 31, 13, 0, 0);

            Assert.IsTrue(dt.InSession(session));
        }
示例#4
0
        public void InSessionReturnsFalseWhenBeforeMultiDaySession()
        {
            var session = new InstrumentSession
            {
                OpeningDay = DayOfTheWeek.Monday,
                ClosingDay = DayOfTheWeek.Tuesday,
                OpeningTime = new TimeSpan(8, 0, 0),
                ClosingTime = new TimeSpan(15, 0, 0)
            };

            //Monday, March 31
            var dt = new DateTime(2014, 3, 31, 7, 0, 0);

            Assert.IsFalse(dt.InSession(session));
        }
示例#5
0
        public void InSessionReturnsTrueWhenInsideMultiDaySession()
        {
            var session = new InstrumentSession
            {
                OpeningDay = DayOfTheWeek.Monday,
                ClosingDay = DayOfTheWeek.Tuesday,
                OpeningTime = new TimeSpan(8, 0, 0),
                ClosingTime = new TimeSpan(15, 0, 0)
            };

            //Tuesday, April 1
            var dt = new DateTime(2014, 4, 1, 7, 0, 0);

            Assert.IsTrue(dt.InSession(session));
        }
示例#6
0
        public void InSessionReturnsFalseWhenAfterOneDaySessionOnNextDay()
        {
            var session = new InstrumentSession
            {
                OpeningDay = DayOfTheWeek.Monday,
                ClosingDay = DayOfTheWeek.Monday,
                OpeningTime = new TimeSpan(8, 0, 0),
                ClosingTime = new TimeSpan(15, 0, 0)
            };

            //Tuesday, April 1
            var dt = new DateTime(2014, 4, 1, 12, 30, 5);

            Assert.IsFalse(dt.InSession(session));
        }
示例#7
0
        public void InSessionReturnsFalseWhenAfterOneDaySessionOnSameDay()
        {
            var session = new InstrumentSession
            {
                OpeningDay = DayOfTheWeek.Monday,
                ClosingDay = DayOfTheWeek.Monday,
                OpeningTime = new TimeSpan(8, 0, 0),
                ClosingTime = new TimeSpan(15, 0, 0)
            };

            //Monday, March 31
            var dt = new DateTime(2014, 3, 31, 16, 30, 5);

            Assert.IsFalse(dt.InSession(session));
        }