Esempio n. 1
0
        public void TestProperties()
        {
            const string exeArgs         = "arggg";
            IProcess     suicidalProcess = new Yams.Process.Process(_suicidalExePath, exeArgs);

            Assert.AreEqual(_suicidalExePath, suicidalProcess.ExePath);
            Assert.AreEqual(exeArgs, suicidalProcess.ExeArgs);
        }
Esempio n. 2
0
        public async Task TestProperties()
        {
            const string exeArgs         = "arggg";
            IProcess     suicidalProcess = new Yams.Process.Process(_fixture.SuicidalProcessIdentity, _fixture.SuicidalExePath, false, new Os.System());
            await suicidalProcess.Start(exeArgs);

            Assert.Equal(_fixture.SuicidalExePath, suicidalProcess.ExePath);
        }
Esempio n. 3
0
        public async Task TestProperties()
        {
            const string exeArgs         = "arggg";
            IProcess     suicidalProcess = new Yams.Process.Process(_fixture.SuicidalProcessIdentity, _fixture.SuicidalExePath, false);
            await suicidalProcess.Start(exeArgs);

            Assert.Equal(_fixture.SuicidalExePath, suicidalProcess.ExePath);
            Assert.Equal($"{exeArgs} --AppName {_fixture.SuicidalProcessIdentity.Id} --AppVersion {_fixture.SuicidalProcessIdentity.Version}", suicidalProcess.ExeArgs);
        }
Esempio n. 4
0
 public async Task TestIsRunning()
 {
     IProcess hangingProcess = new Yams.Process.Process(_hangingExePath, "");
     Assert.IsFalse(hangingProcess.IsRunning);
     await hangingProcess.Start();
     Assert.IsTrue(hangingProcess.IsRunning);
     await hangingProcess.Kill();
     Assert.IsTrue(await ProcessUtils.SpinWaitForExit(hangingProcess, 5));
     Assert.IsFalse(hangingProcess.IsRunning);
 }
Esempio n. 5
0
        public async Task TestIsRunning()
        {
            IProcess hangingProcess = new Yams.Process.Process(_fixture.HangingProcessIdentity, _fixture.HangingExePath, false, new Os.System());

            Assert.False(hangingProcess.IsRunning);
            await hangingProcess.Start(string.Empty);

            Assert.True(hangingProcess.IsRunning);
            await hangingProcess.Kill();

            Assert.True(await ProcessUtils.SpinWaitForExit(hangingProcess, 5));
            Assert.False(hangingProcess.IsRunning);
        }
Esempio n. 6
0
        public async Task TestThatProcessCannotBeStartedMoreThanOnce()
        {
            IProcess hangingProcess = new Yams.Process.Process(_fixture.HangingProcessIdentity, _fixture.HangingExePath, false, new Os.System());
            await hangingProcess.Start(string.Empty);

            Assert.True(hangingProcess.IsRunning);

            await Assert.ThrowsAnyAsync <Exception>(async() => await hangingProcess.Start(string.Empty));

            await hangingProcess.Kill();

            await hangingProcess.ReleaseResources();
        }
Esempio n. 7
0
        public async Task TestIsRunning()
        {
            IProcess hangingProcess = new Yams.Process.Process(_hangingExePath, "");

            Assert.IsFalse(hangingProcess.IsRunning);
            await hangingProcess.Start();

            Assert.IsTrue(hangingProcess.IsRunning);
            await hangingProcess.Kill();

            Assert.IsTrue(await ProcessUtils.SpinWaitForExit(hangingProcess, 5));
            Assert.IsFalse(hangingProcess.IsRunning);
        }
Esempio n. 8
0
        public async Task TestThatProcessCannotBeStartedMoreThanOnce()
        {
            IProcess hangingProcess = new Yams.Process.Process(_hangingExePath, "", false);
            await hangingProcess.Start();

            Assert.True(hangingProcess.IsRunning);

            await Assert.ThrowsAnyAsync <Exception>(async() => await hangingProcess.Start());

            await hangingProcess.Kill();

            await hangingProcess.ReleaseResources();
        }
Esempio n. 9
0
        public async Task TestThatExitedEventIsFired()
        {
            IProcess suicidalProcess = new Yams.Process.Process(_suicidalExePath, "");
            bool     exitedFired     = false;

            suicidalProcess.Exited += (sender, args) =>
            {
                exitedFired = true;
            };
            await suicidalProcess.Start();

            Assert.IsTrue(await ProcessUtils.SpinWaitForExit(suicidalProcess, 5));
            Assert.IsTrue(exitedFired);
            await suicidalProcess.ReleaseResources();
        }
Esempio n. 10
0
        public async Task TestThatExitedEventIsFired()
        {
            IProcess suicidalProcess = new Yams.Process.Process(_fixture.SuicidalProcessIdentity, _fixture.SuicidalExePath, false, new Os.System());
            bool     exitedFired     = false;

            suicidalProcess.Exited += (sender, args) =>
            {
                exitedFired = true;
            };
            await suicidalProcess.Start(string.Empty);

            Assert.True(await ProcessUtils.SpinWaitForExit(suicidalProcess, 5));
            Assert.True(exitedFired);
            await suicidalProcess.ReleaseResources();
        }
Esempio n. 11
0
        public async Task TestReleaseResources()
        {
            IProcess hangingProcess = new Yams.Process.Process(_fixture.HangingProcessIdentity, _fixture.HangingExePath, false);
            await hangingProcess.ReleaseResources(); // should do nothing

            await hangingProcess.Start(string.Empty);

            Assert.True(hangingProcess.IsRunning);

            await Assert.ThrowsAnyAsync <Exception>(async() => await hangingProcess.ReleaseResources());

            await hangingProcess.Kill();

            await hangingProcess.ReleaseResources();
        }
Esempio n. 12
0
 public async Task TestThatProcessCannotBeStartedMoreThanOnce()
 {
     IProcess hangingProcess = new Yams.Process.Process(_hangingExePath, "");
     await hangingProcess.Start();
     Assert.IsTrue(hangingProcess.IsRunning);
     try
     {
         await hangingProcess.Start();
         Assert.Fail("An exception should have been thrown because of the attempt of starting a process that is already running");
     }
     catch (Exception)
     {
         // ignored
     }
     await hangingProcess.Kill();
     await hangingProcess.ReleaseResources();
 }
Esempio n. 13
0
        public async Task TestThatProcessCannotBeStartedMoreThanOnce()
        {
            IProcess hangingProcess = new Yams.Process.Process(_hangingExePath, "");
            await hangingProcess.Start();

            Assert.IsTrue(hangingProcess.IsRunning);
            try
            {
                await hangingProcess.Start();

                Assert.Fail("An exception should have been thrown because of the attempt of starting a process that is already running");
            }
            catch (Exception)
            {
                // ignored
            }
            await hangingProcess.Kill();

            await hangingProcess.ReleaseResources();
        }
Esempio n. 14
0
        public async Task TestReleaseResources()
        {
            IProcess hangingProcess = new Yams.Process.Process(_hangingExePath, "");
            await hangingProcess.ReleaseResources(); // should do nothing
            await hangingProcess.Start();
            Assert.IsTrue(hangingProcess.IsRunning);

            try
            {
                await hangingProcess.ReleaseResources();
                Assert.Fail("An exception should have been thrown because ReleaseResources was called before stopping the process");
            }
            catch (Exception)
            {
                // ignored
            }

            await hangingProcess.Kill();
            await hangingProcess.ReleaseResources();
        }
Esempio n. 15
0
        public async Task TestReleaseResources()
        {
            IProcess hangingProcess = new Yams.Process.Process(_hangingExePath, "");
            await hangingProcess.ReleaseResources(); // should do nothing

            await hangingProcess.Start();

            Assert.IsTrue(hangingProcess.IsRunning);

            try
            {
                await hangingProcess.ReleaseResources();

                Assert.Fail("An exception should have been thrown because ReleaseResources was called before stopping the process");
            }
            catch (Exception)
            {
                // ignored
            }

            await hangingProcess.Kill();

            await hangingProcess.ReleaseResources();
        }
Esempio n. 16
0
 public void TestProperties()
 {
     const string exeArgs = "arggg";
     IProcess suicidalProcess = new Yams.Process.Process(_suicidalExePath, exeArgs);
     Assert.AreEqual(_suicidalExePath, suicidalProcess.ExePath);
     Assert.AreEqual(exeArgs, suicidalProcess.ExeArgs);
 }
Esempio n. 17
0
 public async Task TestThatExitedEventIsFired()
 {
     IProcess suicidalProcess = new Yams.Process.Process(_suicidalExePath, "");
     bool exitedFired = false;
     suicidalProcess.Exited += (sender, args) =>
     {
         exitedFired = true;
     };
     await suicidalProcess.Start();
     Assert.IsTrue(await ProcessUtils.SpinWaitForExit(suicidalProcess, 5));
     Assert.IsTrue(exitedFired);
     await suicidalProcess.ReleaseResources();
 }