Exemplo n.º 1
0
        public void WaitInstruction()
        {
            var wait = new Program.WaitInstruction("4");

            wait.Execute(this.process, this.mock.Action, new List <string>());
            List <string> processes = this.getProcesses();

            Assert.AreEqual(2, processes.Count);
            Assert.IsTrue(processes.Any(s => s.Contains("ar-wait")));

            foreach (int i in Enumerable.Range(0, 3))
            {
                this.tick();
            }
            processes = this.getProcesses();

            Assert.AreEqual(2, processes.Count);
            Assert.IsFalse(this.mock.Called);
            Assert.IsTrue(processes.Any(s => s.Contains("ar-wait")));

            this.tick();
            processes = this.getProcesses();

            Assert.AreEqual(1, processes.Count);
            Assert.IsTrue(this.mock.Called);
            Assert.IsFalse(processes.Any(s => s.Contains("ar-wait")));
        }
Exemplo n.º 2
0
        public void KillWaitInstruction()
        {
            var wait = new Program.WaitInstruction("1");

            wait.Execute(this.process, this.mock.Action, new List <string>());

            Assert.IsFalse(this.mock.Called);

            this.manager.KillAll("ar-wait");

            Assert.IsTrue(this.mock.Called);

            this.tick();

            Assert.AreEqual(1, this.mock.CallCount);
        }
Exemplo n.º 3
0
 string getTime(Program.WaitInstruction i) => this.get(i, "time") as string;