Exemplo n.º 1
0
        public void Test()
        {

            var activeObject = new ActiveObject();
            activeObject.Start();

            for (int i = 1; i < 11; i++)
            {
                var m = i;
                activeObject.AddTask(() =>
                {
                    Console.WriteLine(m);
                    Console.WriteLine(System.Threading.Thread.CurrentThread.IsBackground);
                    System.Threading.Thread.Sleep(500);

                    Console.WriteLine();
                });
            }

            


            System.Threading.Thread.Sleep(4000);
            activeObject.Stop();
        }
Exemplo n.º 2
0
        public void Test3()
        {
            using (var activeObject = new ActiveObject())
            {
                activeObject.Start();
                for (int i = 1; i < 11; i++)
                {
                    var m = i;
                    activeObject.AddTask(() =>
                    {
                        Console.WriteLine(m);
                        Console.WriteLine(Thread.CurrentThread.IsBackground);
                        Thread.Sleep(500);

                        Console.WriteLine();
                    });
                }

                Thread.Sleep(4000);
            }
        }
Exemplo n.º 3
0
        public void Test3()
        {
            using (var activeObject = new ActiveObject())
            {

                activeObject.Start();
                for (int i = 1; i < 11; i++)
                {
                    var m = i;
                    activeObject.AddTask(() =>
                    {
                        Console.WriteLine(m);
                        Console.WriteLine(Thread.CurrentThread.IsBackground);
                        Thread.Sleep(500);

                        Console.WriteLine();
                    });
                }

                Thread.Sleep(4000);
            }
        }
Exemplo n.º 4
0
        public void Test()
        {
            var activeObject = new ActiveObject();

            activeObject.Start();

            for (int i = 1; i < 11; i++)
            {
                var m = i;
                activeObject.AddTask(() =>
                {
                    Console.WriteLine(m);
                    Console.WriteLine(System.Threading.Thread.CurrentThread.IsBackground);
                    System.Threading.Thread.Sleep(500);

                    Console.WriteLine();
                });
            }



            System.Threading.Thread.Sleep(4000);
            activeObject.Stop();
        }
Exemplo n.º 5
0
 public void then_can_start_experiment()
 {
     obj.Start();
     obj.Started.ShouldBeTrue();
 }
Exemplo n.º 6
0
 public void Initialize()
 {
     _invoker.Start();
 }