예제 #1
0
        public ApplyStateContextFacts()
        {
            _connection = new Mock <IStorageConnection>();

            _job = Job.FromExpression(() => Console.WriteLine());

            _stateContext                 = new StateContextMock();
            _stateContext.JobIdValue      = JobId;
            _stateContext.JobValue        = _job;
            _stateContext.ConnectionValue = _connection;

            _newState = new Mock <IState>();
            _newState.Setup(x => x.Name).Returns(NewState);

            _filters  = new List <IApplyStateFilter>();
            _handlers = new StateHandlerCollection();

            _transaction = new Mock <IWriteOnlyTransaction>();
            _connection.Setup(x => x.CreateWriteTransaction()).Returns(_transaction.Object);
        }
예제 #2
0
 public StateHandlerCollectionFacts()
 {
     _collection = new StateHandlerCollection();
 }
예제 #3
0
        private StateHandlerCollection GetHandlers()
        {
            if (_handlersCache == null)
            {
                _handlersCache = new StateHandlerCollection();

                var handlers = _getHandlersThunk(_connection);
                foreach (var handler in handlers)
                {
                    _handlersCache.AddHandler(handler);
                }
            }

            return _handlersCache;
        }