示例#1
0
        public DefaultStateChangeProcessFacts()
        {
            _connection  = new Mock <IStorageConnection>();
            _transaction = new Mock <IWriteOnlyTransaction>();
            _connection.Setup(x => x.CreateWriteTransaction()).Returns(_transaction.Object);

            _state = new Mock <IState>();
            _state.Setup(x => x.Name).Returns(StateName);

            var context = new StateContextMock {
                JobIdValue = JobId
            };

            _electStateContext = new ElectStateContextMock
            {
                StateContextValue   = context,
                CandidateStateValue = _state.Object,
                CurrentStateValue   = OldStateName
            };
            _applyStateContext = new ApplyStateContextMock
            {
                StateContextValue = context,
                NewStateValue     = _state.Object,
                OldStateValue     = OldStateName
            };
        }
        public EnqueuedStateHandlerFacts()
        {
            _context = new ApplyStateContextMock();
            _context.NewStateObject = new EnqueuedState { Queue = Queue };

            _transaction = new Mock<IWriteOnlyTransaction>();
        }
        public FailedStateHandlerFacts()
        {
            _context = new ApplyStateContextMock(JobId);
            _context.NewStateValue = new FailedState(new InvalidOperationException());

            _transaction = new Mock <IWriteOnlyTransaction>();
        }
        public ScheduledStateHandlerFacts()
        {
            _context = new ApplyStateContextMock();
            _context.StateContextValue.JobIdValue = JobId;
            _context.NewStateValue = new ScheduledState(_enqueueAt);

            _transaction = new Mock <IWriteOnlyTransaction>();
        }
        public ScheduledStateHandlerFacts()
        {
            _context = new ApplyStateContextMock();
            _context.StateContextValue.JobIdValue = JobId;
            _context.NewStateValue = new ScheduledState(_enqueueAt);

            _transaction = new Mock<IWriteOnlyTransaction>();
        }
        public DeletedStateHandlerFacts()
        {
            _context = new ApplyStateContextMock();
            _context.StateContextValue.JobIdValue = JobId;
            _context.NewStateValue = new DeletedState();

            _transaction = new Mock<IWriteOnlyTransaction>();
        }
        public ProcessingStateHandlerFacts()
        {
            _context = new ApplyStateContextMock();
            _context.StateContextValue.JobIdValue = JobId;
            _context.NewStateValue = new ProcessingState("server", 1);

            _transaction = new Mock<IWriteOnlyTransaction>();
        }
        public SucceededStateHandlerFacts()
        {
            _context = new ApplyStateContextMock();
            _context.StateContextValue.JobIdValue = JobId;
            _context.NewStateValue = new SucceededState(11, 123);

            _transaction = new Mock <IWriteOnlyTransaction>();
        }
示例#9
0
        public ScheduledStateHandlerFacts()
        {
            _context = new ApplyStateContextMock();
            _context.BackgroundJob.Id = JobId;
            _context.NewStateObject   = new ScheduledState(_enqueueAt);

            _transaction = new Mock <IWriteOnlyTransaction>();
        }
        public SucceededStateHandlerFacts()
        {
            _context = new ApplyStateContextMock();
            _context.StateContextValue.JobIdValue = JobId;
            _context.NewStateValue = new SucceededState(null, 11, 123);

            _transaction = new Mock<IWriteOnlyTransaction>();
        }
示例#11
0
        public FailedStateHandlerFacts()
        {
            _context = new ApplyStateContextMock();
            _context.StateContextValue.JobIdValue = JobId;
            _context.NewStateValue = new FailedState(new InvalidOperationException());

            _transaction = new Mock<IWriteOnlyTransaction>();
        }
        public ProcessingStateHandlerFacts()
        {
            _context = new ApplyStateContextMock();
            _context.StateContextValue.JobIdValue = JobId;
            _context.NewStateValue = new ProcessingState("server", 1);

            _transaction = new Mock <IWriteOnlyTransaction>();
        }
        public ScheduledStateHandlerFacts()
        {
            _context = new ApplyStateContextMock();
            _context.BackgroundJob.Id = JobId;
            _context.NewStateObject = new ScheduledState(_enqueueAt);

            _transaction = new Mock<IWriteOnlyTransaction>();
        }
        public EnqueuedStateHandlerFacts()
        {
            _context = new ApplyStateContextMock();
            _context.StateContextValue.JobIdValue = JobId;
            _context.NewStateValue = new EnqueuedState { Queue = Queue };

            _transaction = new Mock<IWriteOnlyTransaction>();
            _connection = new Mock<IStorageConnection>();
        }
示例#15
0
        public EnqueuedStateHandlerFacts()
        {
            _context = new ApplyStateContextMock();
            _context.NewStateObject = new EnqueuedState {
                Queue = Queue
            };

            _transaction = new Mock <IWriteOnlyTransaction>();
        }
示例#16
0
        public ScheduledStateHandlerFacts()
        {
            _context = new ApplyStateContextMock
            {
                BackgroundJob  = { Id = JobId },
                NewStateObject = new ScheduledState(_enqueueAt, "new_queue")
            };

            _transaction = new Mock <IWriteOnlyTransaction>();
        }
示例#17
0
        public EnqueuedStateHandlerFacts()
        {
            _context = new ApplyStateContextMock();
            _context.StateContextValue.JobIdValue = JobId;
            _context.NewStateValue = new EnqueuedState {
                Queue = Queue
            };

            _transaction = new Mock <IWriteOnlyTransaction>();
            _connection  = new Mock <IStorageConnection>();
        }
示例#18
0
        public CoreStateMachineFacts()
        {
            _stateHandlersThunk = storage => _handlers;
            
            var backgroundJob = new BackgroundJobMock { Id = JobId };
            _applyContext = new ApplyStateContextMock
            {
                BackgroundJob = backgroundJob,
                OldStateName = OldStateName
            };

            _applyContext.NewState.Setup(x => x.Name).Returns(StateName);
        }
示例#19
0
        public CoreStateMachineFacts()
        {
            _stateHandlersThunk = storage => _handlers;

            var backgroundJob = new BackgroundJobMock {
                Id = JobId
            };

            _applyContext = new ApplyStateContextMock
            {
                BackgroundJob = backgroundJob,
                OldStateName  = OldStateName
            };

            _applyContext.NewState.Setup(x => x.Name).Returns(StateName);
        }
        public StateMachineFacts()
        {
            var connection = new Mock <IStorageConnection>();

            _transaction = new Mock <IWriteOnlyTransaction>();
            connection.Setup(x => x.CreateWriteTransaction()).Returns(_transaction.Object);

            var backgroundJob = new BackgroundJobMock {
                Id = JobId
            };

            _context = new ApplyStateContextMock
            {
                BackgroundJob = backgroundJob,
                OldStateName  = OldStateName,
                Transaction   = _transaction
            };

            _filterProvider = new Mock <IJobFilterProvider>();
            _filterProvider.Setup(x => x.GetFilters(It.IsNotNull <Job>())).Returns(
                _filters.Select(f => new JobFilter(f, JobFilterScope.Type, null)));

            _innerMachine = new Mock <IStateMachine>();
        }
示例#21
0
 public ElectStateContextFacts()
 {
     _applyContext = new ApplyStateContextMock();
     _applyContext.OldStateName = "State";
 }
示例#22
0
 public DeletedStateHandlerFacts()
 {
     _context     = new ApplyStateContextMock(JobId);
     _transaction = new Mock <IWriteOnlyTransaction>();
 }
 public AwaitingStateHandlerFacts()
 {
     _context = new ApplyStateContextMock();
 }
示例#24
0
 public DeletedStateHandlerFacts()
 {
     _context = new ApplyStateContextMock();
 }
 public DeletedStateHandlerFacts()
 {
     _context = new ApplyStateContextMock();
 }
示例#26
0
 public ElectStateContextFacts()
 {
     _applyContext = new ApplyStateContextMock();
     _applyContext.OldStateName = "State";
 }
 public SucceededStateHandlerFacts()
 {
     _context = new ApplyStateContextMock();
 }
 public ElectStateContextFacts()
 {
     _applyContext = new ApplyStateContextMock {
         OldStateName = "State"
     };
 }
 public SucceededStateHandlerFacts()
 {
     _context = new ApplyStateContextMock();
 }
 public ElectStateContextFacts()
 {
     _applyContext = new ApplyStateContextMock { OldStateName = "State" };
 }