コード例 #1
0
        public void ShouldComplainIfMoreThanOneProcessExistsToRecycle()
        {
            var launcher = new ApplicationLauncher();
            launcher.Launch(EXAMPLE_APP_PATH, s => Assert.Fail("Should have launched the app"))
                .FindWindow(EXAMPLE_APP_WINDOW_NAME);
            launcher.Launch(EXAMPLE_APP_PATH, s => Assert.Fail("Should have launched the app"))
                .FindWindow(EXAMPLE_APP_WINDOW_NAME);

            var complained = false;
            launcher.Recycle(EXAMPLE_APP_NAME, s => complained = true);
            Assert.True(complained, "Launcher should have complained because two apps with the same name exist");

            complained = false;
            launcher.LaunchOrRecycle(EXAMPLE_APP_NAME, EXAMPLE_APP_PATH, s => complained = true);
            Assert.True(complained, "Launcher should have complained because two apps with the same name exist");
        }
コード例 #2
0
        public void ShouldStartUpApplicationOnRequest()
        {
            var launcher = new ApplicationLauncher();
            var app      = launcher.Launch(EXAMPLE_APP_PATH, s => Assert.Fail("Should have launched the app"));

            app.FindWindow(EXAMPLE_APP_WINDOW_NAME);
            Assert.IsNotNull(app.Process);
        }
コード例 #3
0
        public void ShouldComplainIfMoreThanOneProcessExistsToRecycle()
        {
            var launcher = new ApplicationLauncher();

            launcher.Launch(EXAMPLE_APP_PATH, s => Assert.Fail("Should have launched the app"))
            .FindWindow(EXAMPLE_APP_WINDOW_NAME);
            launcher.Launch(EXAMPLE_APP_PATH, s => Assert.Fail("Should have launched the app"))
            .FindWindow(EXAMPLE_APP_WINDOW_NAME);

            var complained = false;

            launcher.Recycle(EXAMPLE_APP_NAME, s => complained = true);
            Assert.True(complained, "Launcher should have complained because two apps with the same name exist");

            complained = false;
            launcher.LaunchOrRecycle(EXAMPLE_APP_NAME, EXAMPLE_APP_PATH, s => complained = true);
            Assert.True(complained, "Launcher should have complained because two apps with the same name exist");
        }
コード例 #4
0
        public void ShouldRecycleExistingApplicationIfRequested()
        {
            var launcher = new ApplicationLauncher();
            var originalApp = launcher.Launch(EXAMPLE_APP_PATH, s => Assert.Fail("Should have launched the app"));
            originalApp.FindWindow(EXAMPLE_APP_WINDOW_NAME);

            var newApp = launcher.Recycle(EXAMPLE_APP_NAME, s => Assert.Fail("Should have launched the app"));
            newApp.FindWindow(EXAMPLE_APP_WINDOW_NAME);

            Assert.AreEqual(originalApp.Process.Id, newApp.Process.Id);
        }
コード例 #5
0
        public void ShouldComplainIfTheApplicationCantBeLaunched()
        {
            var launcher = new ApplicationLauncher();
            var complained = false;
            launcher.Launch("Wibble.exe", s => complained = true);
            Assert.True(complained, "Launcher should have complained because the app could not be launched");

            complained = false;
            launcher.LaunchOrRecycle("Wibble", "Wibble.exe", s => complained = true);
            Assert.True(complained, "Launcher should have complained because the app could not be launched");
        }
コード例 #6
0
        public void ShouldComplainIfTheApplicationCantBeLaunched()
        {
            var launcher   = new ApplicationLauncher();
            var complained = false;

            launcher.Launch("Wibble.exe", s => complained = true);
            Assert.True(complained, "Launcher should have complained because the app could not be launched");

            complained = false;
            launcher.LaunchOrRecycle("Wibble", "Wibble.exe", s => complained = true);
            Assert.True(complained, "Launcher should have complained because the app could not be launched");
        }
コード例 #7
0
        public void ShouldRecycleExistingApplicationIfRequested()
        {
            var launcher    = new ApplicationLauncher();
            var originalApp = launcher.Launch(EXAMPLE_APP_PATH, s => Assert.Fail("Should have launched the app"));

            originalApp.FindWindow(EXAMPLE_APP_WINDOW_NAME);

            var newApp = launcher.Recycle(EXAMPLE_APP_NAME, s => Assert.Fail("Should have launched the app"));

            newApp.FindWindow(EXAMPLE_APP_WINDOW_NAME);

            Assert.AreEqual(originalApp.Process.Id, newApp.Process.Id);
        }
コード例 #8
0
 public void ShouldStartUpApplicationOnRequest()
 {
     var launcher = new ApplicationLauncher();
     var app = launcher.Launch(EXAMPLE_APP_PATH, s => Assert.Fail("Should have launched the app"));
     app.FindWindow(EXAMPLE_APP_WINDOW_NAME);
     Assert.IsNotNull(app.Process);
 }