当前位置: 首页>>代码示例>>C#>>正文


C# QueueManager.Init方法代码示例

本文整理汇总了C#中QueueManager.Init方法的典型用法代码示例。如果您正苦于以下问题:C# QueueManager.Init方法的具体用法?C# QueueManager.Init怎么用?C# QueueManager.Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueueManager的用法示例。


在下文中一共展示了QueueManager.Init方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetUp

        public void SetUp()
        {
            cars = new List<Car>()
                  {
                     new Car()
                  };

              queueManager = new QueueManager(new MessageProcessorFactory());
              queueManager.Init(cars, 20);
              queueManager.Start();
        }
开发者ID:provenstyle,项目名称:SimulatorDudley,代码行数:11,代码来源:QueueManagerIntegrationTests.cs

示例2: Setup

        public void Setup()
        {
            listOfCars = new List<Car>()
               {
                  new Car(),
                  new Car()
               };

             messageProcessorFactory = new MessageProcessorFactory();
             target = new QueueManager(messageProcessorFactory);
             target.Init(listOfCars, 20);
        }
开发者ID:provenstyle,项目名称:SimulatorDudley,代码行数:12,代码来源:QueueManagerTests.cs

示例3: should_add_new_cars_to_the_manager_after_it_is_started

        public void should_add_new_cars_to_the_manager_after_it_is_started()
        {
            // Arrange
             target = new QueueManager(messageProcessorFactory);
             target.Init(listOfCars, 1);

             // Act
             target.Start();
             target.AddCar(new Car());

             // Assert
             Assert.AreEqual(3, target.ProcessorCount);
        }
开发者ID:provenstyle,项目名称:SimulatorDudley,代码行数:13,代码来源:QueueManagerTests.cs

示例4: should_create_new_thread_queue_messageProcessor_on_unhandled_thread_exception

        public void should_create_new_thread_queue_messageProcessor_on_unhandled_thread_exception()
        {
            // Arrange
              var exceptionCount = 0;
              IMessageProcessorFactory exceptionThrowingMessageProcessorFactory
             = new ExceptionThrowingMessageProcessorFactory();
              queueManager = new QueueManager(exceptionThrowingMessageProcessorFactory);
              queueManager.Init(cars, 1);

              // Act
              queueManager.Start();
              //Thread.Sleep(10);
              var before = queueManager.GetManagedGroup(0).Thread.ManagedThreadId;
              Thread.Sleep(50);
              var after = queueManager.GetManagedGroup(0).Thread.ManagedThreadId;

              // Assert
              Console.WriteLine("Thread Ids before {0} and after {1}", before, after);
              Assert.AreNotEqual(before, after);
        }
开发者ID:provenstyle,项目名称:SimulatorDudley,代码行数:20,代码来源:QueueManagerIntegrationTests.cs

示例5: should_raise_event_on_unhandled_thread_exception

        public void should_raise_event_on_unhandled_thread_exception()
        {
            // Arrange
              bool exceptionEventRaised = false;
              int key = -1;

              IMessageProcessorFactory exceptionThrowingMessageProcessorFactory
             = new ExceptionThrowingMessageProcessorFactory();
              queueManager = new QueueManager(exceptionThrowingMessageProcessorFactory);
              queueManager.Init(cars, 1);

              // Act
              queueManager.UnhandledThreadException += x =>
              {
             exceptionEventRaised = true;
             key = x;
              };

              queueManager.Start();

              Thread.Sleep(20);

              // Assert
              Assert.IsTrue(exceptionEventRaised);
              Assert.AreEqual(0, key);
        }
开发者ID:provenstyle,项目名称:SimulatorDudley,代码行数:26,代码来源:QueueManagerIntegrationTests.cs

示例6: should_keep_count_of_thread_exceptions

        public void should_keep_count_of_thread_exceptions()
        {
            // Arrange
              var exceptionCount = 0;
              IMessageProcessorFactory exceptionThrowingMessageProcessorFactory
             = new ExceptionThrowingMessageProcessorFactory();
              queueManager = new QueueManager(exceptionThrowingMessageProcessorFactory);
              queueManager.Init(cars, 1);

              // Act
              queueManager.Start();
              Thread.Sleep(30);
              exceptionCount = queueManager.GetManagedGroup(0).ExceptionCount;

              // Assert
              Console.WriteLine("Exception count: {0}", exceptionCount);
              Assert.IsTrue(exceptionCount > 1);
        }
开发者ID:provenstyle,项目名称:SimulatorDudley,代码行数:18,代码来源:QueueManagerIntegrationTests.cs

示例7: should_remove_cars_from_the_manager_after_it_is_started

        public void should_remove_cars_from_the_manager_after_it_is_started()
        {
            // Arrange
             target = new QueueManager(messageProcessorFactory);
             target.Init(listOfCars, 1);
             target.Start();

             // Act
             target.RemoveCar(listOfCars[0]);

             // Assert
             Assert.AreEqual(1, target.ProcessorCount);
        }
开发者ID:provenstyle,项目名称:SimulatorDudley,代码行数:13,代码来源:QueueManagerTests.cs

示例8: should_track_what_cars_are_on_a_thread

        public void should_track_what_cars_are_on_a_thread()
        {
            // Arrange
             target = new QueueManager(messageProcessorFactory);
             target.Init(listOfCars, 1);

             // Act
             target.Start();
             var trackedCars = target.GetCarsOnThread(1);

             // Assert
             Assert.AreEqual(listOfCars[1], trackedCars.ToList()[0]);
        }
开发者ID:provenstyle,项目名称:SimulatorDudley,代码行数:13,代码来源:QueueManagerTests.cs

示例9: should_specify_number_of_cars_per_thread

        public void should_specify_number_of_cars_per_thread()
        {
            // Arrange
             target = new QueueManager(messageProcessorFactory);
             target.Init(listOfCars, 1);

             // Act
             target.Start();

             // Assert
             Assert.AreEqual(2, target.ProcessorCount);
        }
开发者ID:provenstyle,项目名称:SimulatorDudley,代码行数:12,代码来源:QueueManagerTests.cs


注:本文中的QueueManager.Init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。