コード例 #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));
        }
コード例 #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]);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }