Exemplo n.º 1
0
 public StoreManager(ICustomersQueue customersQueue, Func <Timer> enqueueTimerFactory, TaskScheduler customerDequeueTaskScheduler,
                     ISleepService sleepService, int maxCashiersCount, int minCashierProcessingTime, int maxCashierProcessingTime, ILogger logger)
 {
     this.customersQueue               = customersQueue;
     this.enqueueTimerFactory          = enqueueTimerFactory;
     this.customerDequeueTaskScheduler = customerDequeueTaskScheduler;
     this.sleepService             = sleepService;
     this.minCashierProcessingTime = minCashierProcessingTime;
     this.maxCashierProcessingTime = maxCashierProcessingTime;
     this.logger               = logger;
     this.taskFactory          = new TaskFactory(customerDequeueTaskScheduler);
     this.maxCashiersSemaphore = new SemaphoreSlim(maxCashiersCount);
 }
Exemplo n.º 2
0
 public StoreManager(ICustomersQueue customersQueue, Func <Timer> enqueueCustomerTimerFactory, TaskScheduler customerDequeueTaskScheduler,
                     ISleepService sleepService, int maxCashiersCount, int minCashierProcessingTime, int maxCashierProcessingTime, ILogger logger)
 {
     this.customersQueue = customersQueue;
     this.enqueueCustomerTimerFactory  = enqueueCustomerTimerFactory;
     this.customerDequeueTaskScheduler = customerDequeueTaskScheduler;
     this.sleepService             = sleepService;
     this.cashiersCount            = maxCashiersCount;
     this.minCashierProcessingTime = minCashierProcessingTime;
     this.maxCashierProcessingTime = maxCashierProcessingTime;
     this.logger                  = logger;
     this.taskFactory             = new TaskFactory(customerDequeueTaskScheduler);
     this.cancellationTokenSource = new CancellationTokenSource();
 }
Exemplo n.º 3
0
 public void Setup()
 {
     _server         = Substitute.For <IServer <ICustomer> >();
     _customersQueue = Substitute.For <ICustomersQueue <ICustomer> >();
     _sleepingBarber = new SleepingBarber <ICustomer>(_customersQueue, _server);
 }
Exemplo n.º 4
0
 public BarberController(ICustomersQueue <WebCustomer> queue, ISleepingBarber <WebCustomer> barber)
 {
     _queue  = queue;
     _barber = barber;
 }
Exemplo n.º 5
0
 public SleepingBarber(ICustomersQueue <T> customersQueue, IServer <T> server)
 {
     _server         = server;
     _customersQueue = customersQueue;
     _customersQueue.CustomerArrived += ProcessCustomerQueue;
 }