示例#1
0
        public void Restart_WillShutdownThroughDispatcher_Always()
        {
            var restarter = new Fake_AppRestarter();

            restarter.Restart();

            Assert.IsTrue(restarter.CalledShutdownApplicationThroughBeginInvoke);
        }
示例#2
0
        public void Restart_WillShutdownThroughDispatcher_Always()
        {
            var restarter = new Fake_AppRestarter();

            restarter.Restart();

            Assert.IsTrue(restarter.CalledShutdownApplicationThroughBeginInvoke);
        }
示例#3
0
        public void Restart_WillShutdownProcessAfterLaunchingAnotherInstance_Always()
        {
            var restarter = new Fake_AppRestarter();
            restarter.ForcedCurrentProcessAssemblyLocation = "dummyProcess.exe";

            restarter.Restart();

            Assert.IsTrue(restarter.CalledShutdownApplication);
        }
示例#4
0
        public void Restart_WillShutdownProcessAfterLaunchingAnotherInstance_Always()
        {
            var restarter = new Fake_AppRestarter();

            restarter.ForcedCurrentProcessAssemblyLocation = "dummyProcess.exe";

            restarter.Restart();

            Assert.IsTrue(restarter.CalledShutdownApplication);
        }
示例#5
0
        public void Restart_WillSpawnSameProcessAgain_Always()
        {
            var restarter = new Fake_AppRestarter();
            restarter.ForcedCurrentProcessAssemblyLocation = "dummyProcess.exe";

            restarter.Restart();

            Assert.AreEqual("dummyProcess.exe", restarter.ProcessStartedFilename);
            Assert.AreEqual(null, restarter.ProcessStartedArguments);
        }
示例#6
0
        public void Restart_WillSpawnSameProcessAgain_Always()
        {
            var restarter = new Fake_AppRestarter();

            restarter.ForcedCurrentProcessAssemblyLocation = "dummyProcess.exe";

            restarter.Restart();

            Assert.AreEqual("dummyProcess.exe", restarter.ProcessStartedFilename);
            Assert.AreEqual(null, restarter.ProcessStartedArguments);
        }
        public void FsChange_WontMakeRestart_WhenDllOutsideWatchedFolderChanged()
        {
            var dummyFsWatcherProxy = new Fake_FsWatcherProxy();
            RestartHandler restartHandler = new RestartHandler();
            var spyRestarter = new Fake_AppRestarter();
            restartHandler.Init(spyRestarter, @"C:\watchedFolder", dummyFsWatcherProxy);

            restartHandler.OnFsChange(@"C:\otherFolder\abc.dll");

            Assert.AreEqual(0, spyRestarter.CalledRestartsCount);
        }
        public void FsChange_WillMakeRestart_WhenDllInWatchedFolderChanged()
        {
            var dummyFsWatcherProxy = new Fake_FsWatcherProxy();
            RestartHandler restartHandler = new RestartHandler();
            var spyRestarter = new Fake_AppRestarter();
            restartHandler.Init(spyRestarter, @"C:\watchedFolder", dummyFsWatcherProxy);

            restartHandler.OnFsChange(@"C:\watchedFolder\abc.dll");

            Assert.IsTrue(spyRestarter.CalledRestartsCount > 0);
        }
        public void FsChange_WontMakeMultipleRestarts_WhenMultipleFsChangesDetected()
        {
            var dummyFsWatcherProxy = new Fake_FsWatcherProxy();
            RestartHandler restartHandler = new RestartHandler();
            var spyRestarter = new Fake_AppRestarter();
            restartHandler.Init(spyRestarter, @"C:\watchedFolder", dummyFsWatcherProxy);

            restartHandler.OnFsChange(@"C:\watchedFolder\abc.dll");
            restartHandler.OnFsChange(@"C:\watchedFolder\abc.dll");
            restartHandler.OnFsChange(@"C:\watchedFolder\abc.dll");

            Assert.AreEqual(1, spyRestarter.CalledRestartsCount);
        }
示例#10
0
        public void FsChange_WontMakeRestart_WhenFsChangeDetectedBothDuringAndAfterLoadingTime()
        {
            var dummyFsWatcherProxy = new Fake_FsWatcherProxy();
            RestartHandler restartHandler = new RestartHandler();
            var spyRestarter = new Fake_AppRestarter();
            restartHandler.Init(spyRestarter, @"C:\watchedFolder", dummyFsWatcherProxy);

            restartHandler.OnLoadingBegin();
            restartHandler.OnFsChange(@"C:\watchedFolder\abc.dll");
            restartHandler.OnLoadingEnd();
            restartHandler.OnFsChange(@"C:\watchedFolder\abc.dll");

            Assert.AreEqual(0, spyRestarter.CalledRestartsCount);
        }
示例#11
0
        public void RestartNow_WillMakeRestart_Always()
        {
            var dummyFsWatcherProxy = new Fake_FsWatcherProxy();
            RestartHandler restartHandler = new RestartHandler();
            var spyRestarter = new Fake_AppRestarter();
            restartHandler.Init(spyRestarter, null, dummyFsWatcherProxy);

            restartHandler.RestartNow();

            Assert.IsTrue(spyRestarter.CalledRestartsCount > 0);
        }