Beispiel #1
0
        public List <DateTime> CheckIfCalculationsRequired(DataMessage dataMessage)
        {
            List <DateTime> hoursToCalculateAverages = new List <DateTime>();

            foreach (PerSecondStat second in dataMessage.RealTimeStats)
            {
                // Create this function in the Helper Sevices DateTimeTools class.
                // Regular Expression that checks if the PerSecondStat is the last second of that hour.
                if (MySqlDateTimeTools.IsLastSecondOfHour(second.DateTime))
                {
                    hoursToCalculateAverages.Add(MySqlDateTimeConverter.ToDateTime(second.DateTime).GetHourBeginning());
                }
            }

            return(hoursToCalculateAverages);
        }
Beispiel #2
0
        public void IsLastSecondOfHourTestToFail_2()
        {
            string test = "2004-33-12 75:59:58";

            Assert.IsFalse(MySqlDateTimeTools.IsLastSecondOfHour(test));
        }
Beispiel #3
0
        public void IsLastSecondOfHourTestToPass()
        {
            string test = "1805-28-99 65:59:59";

            Assert.IsTrue(MySqlDateTimeTools.IsLastSecondOfHour(test));
        }