コード例 #1
0
        private static void SaqExercise1(int id, SecuritySystem securitySystem)
        {
            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 _        = new SecurityContext(TestUser.User2, securitySystem);
                var activity = new TestWaitActivity(_rnd.Next(1, 3));
                securitySystem.DataHandler.SaveActivity(activity);

                var method = typeof(SecuritySystem).GetMethod("MessageProvider_MessageReceived", BindingFlags.Instance | BindingFlags.NonPublic);
                if (method == null)
                {
                    throw new ApplicationException("Method not found: MessageProvider_MessageReceived");
                }

                method.Invoke(securitySystem, new object[] { null, new MessageReceivedEventArgs(activity) });
                count++;
            }
        }
コード例 #2
0
        private static void SaqExercise2(int id, SecuritySystem securitySystem)
        {
            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 _        = new SecurityContext(TestUser.User2, securitySystem);
                var activity = new TestWaitActivity(_rnd.Next(1, 3));
                securitySystem.DataHandler.SaveActivity(activity);

                count++;
            }
        }