コード例 #1
0
        public void CheckCorrectWZone(
            ScheduleSpec spec,
            string nowWZone,
            string expectedWZone)
        {
            var nowDate      = DateTimeParsingFunctions.ParseDefaultMSecWZone(nowWZone);
            var expectedDate = DateTimeParsingFunctions.ParseDefaultMSecWZone(expectedWZone);

            var result = ScheduleComputeHelper.ComputeNextOccurance(
                spec, nowDate,
                TimeZoneInfo.Utc,
                TimeAbacusMilliseconds.INSTANCE);
            var resultDate = DateTimeEx.GetInstance(TimeZoneInfo.Utc, result);

            if (result != expectedDate)
            {
                Log.Debug(
                    ".checkCorrect Difference in result found, spec=" + spec);
                Log.Debug(
                    ".checkCorrect now=" + timeFormat.Format(nowDate.TimeFromMillis()) +
                    " long=" + nowDate);
                Log.Debug(
                    ".checkCorrect expected=" + timeFormat.Format(expectedDate.TimeFromMillis()) +
                    " long=" + expectedDate);
                Log.Debug(
                    ".checkCorrect result=" + timeFormat.Format(resultDate) +
                    " long=" + resultDate.UtcMillis);
                Assert.IsTrue(false);
            }
        }
コード例 #2
0
        public void CheckCorrect(
            ScheduleSpec spec,
            string now,
            string expected)
        {
            var nowDate      = timeFormat.Parse(now);
            var expectedDate = timeFormat.Parse(expected);

            var result = ScheduleComputeHelper.ComputeNextOccurance(
                spec, nowDate.UtcMillis, TimeZoneInfo.Utc, TimeAbacusMilliseconds.INSTANCE);
            var resultDate = DateTimeEx.GetInstance(TimeZoneInfo.Utc, result);

            if (!resultDate.Equals(expectedDate))
            {
                Log.Debug(".checkCorrect Difference in result found, spec=" + spec);
                Log.Debug(
                    ".checkCorrect      now=" + timeFormat.Format(nowDate) +
                    " long=" + nowDate.UtcMillis);
                Log.Debug(
                    ".checkCorrect expected=" + timeFormat.Format(expectedDate) +
                    " long=" + expectedDate.UtcMillis);
                Log.Debug(
                    ".checkCorrect   result=" + timeFormat.Format(resultDate) +
                    " long=" + resultDate.UtcMillis);
                Assert.IsTrue(false);
            }
        }