public ImplementMeServiceTest_ProcessMessageAsync() { var repository = Substitute.For <IKVRepository>(); repository.DeleteAsync(Arg.Any <string>()) .Returns(Task.FromResult(new ActionResult { IsSuccessfull = true })); _repository = repository; var logService = Substitute.For <ILogService>(); _logService = logService; var centralizedLock = Substitute.For <CentralizedLock>(_repository, 30, _logService); centralizedLock.TryAcquireAsync(Arg.Any <string>()) .Returns(Task.FromResult(new CentralizedLockItem(() => { }, true))); _centralizedLock = centralizedLock; var processService = Substitute.For <IMessageProcessService>(); processService.ProccessMessageAsync(Arg.Any <RingbaUOW>()) .Returns(Task.FromResult(new ActionResult { IsSuccessfull = true })); _processService = processService; }
public ImplementMeService(IKVRepository repository, ILogService logService, IMessageProcessService messageProcessService, IMessageQueService messageQueService) : this(repository, logService, messageProcessService, messageQueService, null) { }
public ImplementMeService( IKVRepository repository, ILogService logService, IMessageProcessService messageProcessService, IMessageQueService messageQueService) { _repository = repository; _logservice = logService; _queService = messageQueService; _processService = messageProcessService; }
public ImplementMeServiceTest_ClearTryCountAsync() { var repository = Substitute.For <IKVRepository>(); repository.DeleteAsync(Arg.Any <string>()) .Returns(Task.FromResult(new ActionResult { IsSuccessfull = true })); _repository = repository; }
public ImplementMeService(IKVRepository repository, ILogService logService, IMessageProcessService messageProcessService, IMessageQueService messageQueService, CentralizedLock centralizedLock = null, CancellationTokenSource cancellationTokenSource = null, TimeSpan?maxStopWait = null) { _repository = repository; _logservice = logService; _queService = messageQueService; _processService = messageProcessService; _cancellationTokenSource = cancellationTokenSource ?? new CancellationTokenSource(); _maxStopWait = maxStopWait ?? TimeSpan.FromSeconds(5); _centralizedLock = centralizedLock ?? new CentralizedLock(repository, -1, _logservice); }
public ImplementMeServiceTest_ShouldRequeueAsync() { var repository = Substitute.For <IKVRepository>(); repository.DeleteAsync(Arg.Any <string>()) .Returns(Task.FromResult(new ActionResult { IsSuccessfull = true })); repository.CreateAsync(Arg.Any <CreateKVRequest <MessageWrapper <int> > >()) .Returns(Task.FromResult(new ActionResult { IsSuccessfull = true })); repository.GetAsync <MessageWrapper <int> >(Arg.Any <string>()) .Returns(Task.FromResult(new Result <MessageWrapper <int> > { IsSuccessfull = true, Item = new MessageWrapper <int>() })); repository.UpdateAsync(Arg.Any <string>(), Arg.Any <MessageWrapper <int> >()) .Returns(Task.FromResult(new ActionResult { IsSuccessfull = true })); _repository = repository; }
public CentralizedLock(IKVRepository repository, int timeoutInSeconds, ILogService logService) { _repository = repository; _timeoutInSeconds = timeoutInSeconds; _logService = logService; }