Ejemplo n.º 1
0
        public void ShutDown_WillNotifySingleInstanceGuard_Always()
        {
            var spySingleInstanceGuard = new Mock <ISingleAppInstanceGuard>();
            var restarter = new Fake_AppRestarter();

            restarter.Init(spySingleInstanceGuard.Object);

            restarter.ShutDown();

            spySingleInstanceGuard.Verify(g => g.OnBeforeAppShutDown(), Times.Exactly(1));
        }
Ejemplo n.º 2
0
        public void ShutDownAndRestart_WillStartNewProcessWithStartArgument_WithoutSpecifyingStartArguments()
        {
            var stubSingleInstanceGuard = new Mock <ISingleAppInstanceGuard>();
            var restarter = new Fake_AppRestarter();

            restarter.Init(stubSingleInstanceGuard.Object);

            restarter.ShutDownAndRestart(null);

            Assert.AreEqual(TimeMerge.App.NightlyRestart, restarter.CalledAppStartParams[0]);
        }
Ejemplo n.º 3
0
        public void ShutDown_WillCallAppShutdown_Always()
        {
            var stubSingleInstanceGuard = new Mock <ISingleAppInstanceGuard>();
            var restarter = new Fake_AppRestarter();

            restarter.Init(stubSingleInstanceGuard.Object);

            restarter.ShutDown();

            Assert.IsTrue(restarter.CalledAppShutdown);
        }
Ejemplo n.º 4
0
        public void ShutDownAndRestart_WillStartNewProcessAfterShuttingDownThisOne_Always()
        {
            var stubSingleInstanceGuard = new Mock <ISingleAppInstanceGuard>();
            var restarter = new Fake_AppRestarter();

            restarter.Init(stubSingleInstanceGuard.Object);

            restarter.ShutDownAndRestart(null);

            Assert.IsTrue(restarter.CalledAppStartTimeOffset != TimeSpan.Zero);
            Assert.IsTrue(restarter.CalledAppShutdownTimeOffset != TimeSpan.Zero);
            Assert.IsTrue(restarter.CalledAppStartTimeOffset > restarter.CalledAppShutdownTimeOffset);
        }
Ejemplo n.º 5
0
        public void ShutDownAndRestart_WillStartNewProcessWithStartArgument_WhenStartArgumentSpecified()
        {
            var stubSingleInstanceGuard = new Mock <ISingleAppInstanceGuard>();
            var restarter = new Fake_AppRestarter();

            restarter.Init(stubSingleInstanceGuard.Object);

            restarter.ShutDownAndRestart("/dummyParam");

            Assert.AreEqual("/dummyParam", restarter.CalledAppStartParams[0]);
            Assert.AreEqual(TimeMerge.App.NightlyRestart, restarter.CalledAppStartParams[1]);
            Assert.AreEqual(2, restarter.CalledAppStartParams.Count);
        }