public PoolControllerTests()
 {
     _key = new TestKey
     {
         Identifier = 48635,
     };
     _settings = new PoolControllerSettings
     {
         CallingReleaseOperationWillHappen = true,
     };
     _noObjectDirection = new DirectionIfNoObjectIsAvailable<TestKey, TestResource>();
 }
        private PoolController<int, ThreadWorker> CreateThreadPoolControllerInstance()
        {
            var workerActions = new ObjectActionsBasedOnDelegateOrInterface<ThreadWorker>(new ExplicitlyDefinedObjectActions<ThreadWorker>());
            var objectUtilizer = new ObjectUtilizer<int, ThreadWorker>();

            var basicPoolSettings = new PoolItemsStorageSettings
            {
                AllowOnlyOneUserPerObject = true,
                BalancingStrategy = _settings.BalancingStrategy,
                MaxObjectsCountPerKey = _settings.MaxWorkersCount,
                ThrowIfCantCreateObjectBecauseOfReachedLimit = false,
            };
            var basicPool = new PoolItemsStorage<int, ThreadWorker>(basicPoolSettings, workerActions, objectUtilizer);

            var stateMonitoringSettings = new PWObjectStateMonitoringSettings
            {
                MaxObjectIdleTimeSpanInSeconds = _settings.MaxObjectIdleTimeSpanInSeconds,
                MaxObjectLifetimeInSeconds = _settings.MaxObjectIdleTimeSpanInSeconds,
                TimeSpanBetweenRevivalsInSeconds = _settings.MonitorTimeSpanInSeconds,
            };
            var stateMonitoringPool = new PWObjectStateMonitoringWrapper<int, ThreadWorker>(stateMonitoringSettings,
                                                                                            basicPool,
                                                                                            workerActions,
                                                                                            objectUtilizer);

            var singleUsePool = new PWSingleUseEnforcingWrapper<int, ThreadWorker>(stateMonitoringPool);

            var autoReleasingPool = new PWAutoReleasingWrapper<int, ThreadWorker>(singleUsePool);

            var poolControllerSettings = new PoolControllerSettings
            {
                CallingReleaseOperationWillHappen = true,
            };
            var controller = new PoolController<int, ThreadWorker>(poolControllerSettings, autoReleasingPool);
            autoReleasingPool.SetPoolController(controller);
            return controller;
        }