public ServerJobCancellationWatcherFacts()
        {
            _checkInterval = Timeout.InfiniteTimeSpan;

            _context = new BackgroundProcessContextMock();
            _context.StoppingTokenSource.Cancel();

            _connection = new Mock <IStorageConnection>();
            _context.Storage.Setup(x => x.GetConnection()).Returns(_connection.Object);

            ServerJobCancellationToken.AddServer(_context.ServerId);
        }
示例#2
0
        public ServerJobCancellationTokenFacts()
        {
            _stateData = new StateData
            {
                Name = ProcessingState.StateName,
                Data = new Dictionary <string, string>
                {
                    { "ServerId", ServerId },
                    { "WorkerId", WorkerId },
                }
            };

            _connection = new Mock <IStorageConnection>();
            _connection.Setup(x => x.GetStateData(JobId)).Returns(_stateData);

            _cts         = new CancellationTokenSource();
            _shutdownCts = new CancellationTokenSource();

            ServerJobCancellationToken.AddServer(ServerId);
        }