Example #1
0
        public void AgentRestart()
        {
            TestAgent t = new TestAgent(output);

            t.Start();
            Assert.AreEqual <ThreadState>(ThreadState.Running, t.State, "Agent state is wrong after initial start");
            Thread.Sleep(100);

            t.Stop();
            Assert.AreEqual <ThreadState>(ThreadState.Stopped, t.State, "Agent state is wrong after initial stop");
            Thread.Sleep(100);

            try
            {
                t.Start();
            }
            catch (Exception ex)
            {
                Assert.Fail("Exception while restarting agent: " + ex.ToString());
                throw;
            }
            Assert.AreEqual <ThreadState>(ThreadState.Running, t.State, "Agent state is wrong after restart");
            Thread.Sleep(100);

            t.Stop();
            Assert.AreEqual <ThreadState>(ThreadState.Stopped, t.State, "Agent state is wrong after final stop");
            Thread.Sleep(100);
        }
        public void AgentRestart()
        {
            TestAgent t = new TestAgent(output);

            t.Start();
            Assert.Equal(ThreadState.Running, t.State); // "Agent state is wrong after initial start"
            Thread.Sleep(100);

            t.Stop();
            Assert.Equal(ThreadState.Stopped, t.State); // "Agent state is wrong after initial stop"
            Thread.Sleep(100);

            try
            {
                t.Start();
            }
            catch (Exception ex)
            {
                Assert.True(false, "Exception while restarting agent: " + ex);
                throw;
            }
            Assert.Equal(ThreadState.Running, t.State); // "Agent state is wrong after restart"
            Thread.Sleep(100);

            t.Stop();
            Assert.Equal(ThreadState.Stopped, t.State); // "Agent state is wrong after final stop"
            Thread.Sleep(100);
        }
        public void AgentRestart()
        {
            TestAgent t = new TestAgent(output);

            t.Start();
            Assert.AreEqual<ThreadState>(ThreadState.Running, t.State, "Agent state is wrong after initial start");
            Thread.Sleep(100);

            t.Stop();
            Assert.AreEqual<ThreadState>(ThreadState.Stopped, t.State, "Agent state is wrong after initial stop");
            Thread.Sleep(100);

            try
            {
                t.Start();
            }
            catch (Exception ex)
            {
                Assert.Fail("Exception while restarting agent: " + ex.ToString());
                throw;
            }
            Assert.AreEqual<ThreadState>(ThreadState.Running, t.State, "Agent state is wrong after restart");
            Thread.Sleep(100);

            t.Stop();
            Assert.AreEqual<ThreadState>(ThreadState.Stopped, t.State, "Agent state is wrong after final stop");
            Thread.Sleep(100);
        }
        public void AgentRestart()
        {
            TestAgent t = new TestAgent(output);

            t.Start();
            Assert.Equal(ThreadState.Running, t.State); // "Agent state is wrong after initial start"
            Thread.Sleep(100);

            t.Stop();
            Assert.Equal(ThreadState.Stopped, t.State); // "Agent state is wrong after initial stop"
            Thread.Sleep(100);

            try
            {
                t.Start();
            }
            catch (Exception ex)
            {
                Assert.True(false, "Exception while restarting agent: " + ex);
                throw;
            }
            Assert.Equal(ThreadState.Running, t.State); // "Agent state is wrong after restart"
            Thread.Sleep(100);

            t.Stop();
            Assert.Equal(ThreadState.Stopped, t.State); // "Agent state is wrong after final stop"
            Thread.Sleep(100);
        }
Example #5
0
        public void AgentStopWhileStopped()
        {
            TestAgent t = new TestAgent(output);

            t.Start();
            Thread.Sleep(100);

            t.Stop();
            Thread.Sleep(100);

            try
            {
                t.Stop();
            }
            catch (Exception ex)
            {
                Assert.Fail("Exception while stopping agent that is already stopped: " + ex.ToString());
                throw;
            }
        }
        public void AgentStopWhileStopped()
        {
            TestAgent t = new TestAgent(output, this.serviceProvider);

            t.Start();
            Thread.Sleep(100);

            t.Stop();
            Thread.Sleep(100);

            try
            {
                t.Stop();
            }
            catch (Exception ex)
            {
                Assert.True(false, "Exception while stopping agent that is already stopped: " + ex.ToString());
                throw;
            }
        }
        public void AgentStopWhileStopped()
        {
            TestAgent t = new TestAgent();

            t.Start();
            Thread.Sleep(100);

            t.Stop();
            Thread.Sleep(100);

            try
            {
                t.Stop();
            }
            catch (Exception ex)
            {
                Assert.Fail("Exception while stopping agent that is already stopped: " + ex.ToString());
                throw;
            }
        }
        public void AgentStartWhileStarted()
        {
            TestAgent t = new TestAgent(output);

            t.Start();
            Thread.Sleep(100);

            try
            {
                t.Start();
            }
            catch (Exception ex)
            {
                Assert.True(false,"Exception while starting agent that is already started: " + ex.ToString());
                throw;
            }

            t.Stop();
        }