示例#1
0
        private static void SAQExercise2(int id)
        {
            var name  = "WaitC-" + id;
            var count = 0;

            while (!_stopped)
            {
                Thread.Sleep(30);

                if (0 == (count % 100))
                {
                    Console.WriteLine("Running time: {0}, errors: {1}. {2} {3}", DateTime.UtcNow - started, errors, name, count);
                }

                var ctx      = new SecurityContext(TestUser.User2);
                var activity = new Test_WaitActivity(_rnd.Next(1, 3));
                DataHandler.SaveActivity(activity);

                count++;
            }
        }
示例#2
0
        private static void SAQExercise1(int id)
        {
            var name  = "WaitB-" + id;
            var count = 0;

            while (!_stopped)
            {
                Thread.Sleep(10);

                if (0 == (count % 100))
                {
                    Console.WriteLine("Running time: {0}, errors: {1}. {2} {3}", DateTime.UtcNow - started, errors, name, count);
                }

                var ctx      = new SecurityContext(TestUser.User2);
                var activity = new Test_WaitActivity(_rnd.Next(1, 3));
                DataHandler.SaveActivity(activity);
                var method = typeof(SecurityContext).GetMethod("MessageProvider_MessageReceived", BindingFlags.Static | BindingFlags.NonPublic);
                method.Invoke(null, new object[] { null, new MessageReceivedEventArgs(activity) });

                count++;
            }
        }