Exemple #1
0
        public void SmashController_SlowThreadTest()
        {
            int             iteration = 1;
            SmashController sc        = new SmashController();

            // Put jobs into the queue
            int Counter1 = 0;

            sc.Enqueue(iteration, (t, i) => {
                System.Threading.Thread.Sleep(3000);
                Counter1++;
                return(true);
            });

            int Counter2 = 0;

            sc.Enqueue(iteration, (t, i) => {
                System.Threading.Thread.Sleep(3000);
                Counter2++;
                return(true);
            });

            // Run
            Assert.True(sc.Run());

            // Check output
            Assert.Equal(iteration, Counter1);
            Assert.Equal(iteration, Counter2);

            // output result, check test output
            this.output.WriteLine(sc.ToString());
        }
Exemple #2
0
        public void SmashController_LotsOfThreadTest()
        {
            int             threads   = 250;
            int             iteration = 1;
            SmashController sc        = new SmashController();

            for (int i = 0; i < threads; ++i)
            {
                // Put jobs into the queue
                sc.Enqueue(iteration, (t, it) => {
                    System.Threading.Thread.Sleep(3000);
                    return(true);
                });
            }

            // Run
            Assert.True(sc.Run());

            // output result, check test output
            this.output.WriteLine(sc.ToString());
        }