Example #1
0
        private IAppMainteanceManager getInitMaintenaceManger(IAppStrategyManager stgManager)
        {
            IAppMainteanceManager maintenanceManager = new AppMainteanceManager(stgManager);

            maintenanceManager.lunchTimeRTBReset   = false;
            maintenanceManager.morningTimeRTBReset = false;
            maintenanceManager.dailyAllFlagsInit   = true;
            return(maintenanceManager);
        }
Example #2
0
        public void test_getResetTime()
        {
            DateTime beforeResetTime = new DateTime(2015, 12, 10, 21, 0, 0, DateTimeKind.Local);
            DateTime atResetTime     = new DateTime(2015, 12, 11, 0, 10, 0, DateTimeKind.Local);
            DateTime afterResetTime  = new DateTime(2015, 12, 11, 11, 0, 0, DateTimeKind.Local);
            IAppMainteanceManager maintenanceManager = new AppMainteanceManager(null);

            DateTime beforeResultTime = new DateTime(2015, 12, 10, 0, 10, 0, DateTimeKind.Local);
            DateTime atResultTime     = new DateTime(2015, 12, 11, 0, 10, 0, DateTimeKind.Local);
            DateTime afterResultTime  = new DateTime(2015, 12, 11, 0, 10, 0, DateTimeKind.Local);

            //[input time is before reset[T] time, it would return 0 hour of T-1 time.]
            Assert.AreEqual(beforeResultTime, AppMainteanceManager.getResetTime(beforeResetTime));
            //[input time is at reset[T] time, it would return 0 hour of T time.]
            Assert.AreEqual(afterResultTime, AppMainteanceManager.getResetTime(afterResultTime));
            //[input time is after reset[T] time, it would return 0 hour of T time.]
            Assert.AreEqual(atResultTime, AppMainteanceManager.getResetTime(atResetTime));
        }
Example #3
0
        public void test_resetDailyAllFlag()
        {
            DateTime ResetTime1st = new DateTime(2015, 12, 10, 21, 0, 0, DateTimeKind.Local);
            DateTime ResetTime2nd = new DateTime(2015, 12, 11, 0, 10, 0, DateTimeKind.Local);
            DateTime ResetTime3rd = new DateTime(2015, 12, 12, 01, 10, 0, DateTimeKind.Local);

            DateTime ResultTime1st = new DateTime(2015, 12, 10, 0, 10, 0, DateTimeKind.Local);
            DateTime ResultTime2nd = new DateTime(2015, 12, 11, 0, 10, 0, DateTimeKind.Local);
            DateTime ResultTime3rd = new DateTime(2015, 12, 12, 0, 10, 0, DateTimeKind.Local);

            IAppMainteanceManager maintenanceManager = new AppMainteanceManager(null);

            maintenanceManager.resetDailyAllFlag(ResetTime1st);
            Assert.AreEqual(1, maintenanceManager.CompleteDailyReset.Count);
            Assert.IsNotNull(maintenanceManager.CompleteDailyReset[ResultTime1st]);

            maintenanceManager.resetDailyAllFlag(ResetTime2nd);
            Assert.AreEqual(2, maintenanceManager.CompleteDailyReset.Count);
            Assert.IsNotNull(maintenanceManager.CompleteDailyReset[ResultTime2nd]);

            maintenanceManager.resetDailyAllFlag(ResetTime3rd);
            Assert.AreEqual(3, maintenanceManager.CompleteDailyReset.Count);
            Assert.IsNotNull(maintenanceManager.CompleteDailyReset[ResultTime3rd]);
        }