public void Restart_WillShutdownThroughDispatcher_Always() { var restarter = new Fake_AppRestarter(); restarter.Restart(); Assert.IsTrue(restarter.CalledShutdownApplicationThroughBeginInvoke); }
public void Restart_WillShutdownProcessAfterLaunchingAnotherInstance_Always() { var restarter = new Fake_AppRestarter(); restarter.ForcedCurrentProcessAssemblyLocation = "dummyProcess.exe"; restarter.Restart(); Assert.IsTrue(restarter.CalledShutdownApplication); }
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); }
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); }
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); }