コード例 #1
0
ファイル: OkHeyResponse.cs プロジェクト: radtek/Hey
        public OkHeyResponse(IMethodBinder methodBinder, IScheduleType scheduleType, IHttpReturnType returnType)
        {
            _methodBinder = methodBinder;
            _scheduleType = scheduleType;
            _returnType   = returnType;

            _log = LogManager.GetLogger(GetType());
        }
コード例 #2
0
        public void TestWithCronExpression_ShouldReturnRecurringScheduleType()
        {
            HeyRememberDto heyRemember = new HeyRememberDto
            {
                CronExpression = "* * * * * *"
            };
            IScheduleType scheduleType = _repository.MakeASchedulePrototype(heyRemember);

            Assert.IsInstanceOf(typeof(RecurringScheduleType), scheduleType);
        }
コード例 #3
0
        public void TestWithEmptyCronExpression_ShouldReturnDelayedScheduleType()
        {
            HeyRememberDto heyRemember = new HeyRememberDto
            {
                CronExpression = string.Empty
            };
            IScheduleType scheduleType = _repository.MakeASchedulePrototype(heyRemember);

            Assert.IsInstanceOf(typeof(DelayedScheduleType), scheduleType);
        }
コード例 #4
0
        public IHeyResponse Make(IScheduleType prototype, IHttpReturnType returnType)
        {
            HeyRememberDto         heyRemember   = _methodBinder.CreateDeferredExecution().HeyRemember;
            BinderCanCallTheMethod binderCanCall = new BinderCanCallTheMethod(_methodBinder);

            if (binderCanCall.Can)
            {
                return(new OkHeyResponse(_methodBinder, prototype.Prototype(), returnType));
            }

            if (binderCanCall.ExecutionResultEnum == MethodExecutionResultEnum.Empty)
            {
                return(new MethodNotFoundHeyResponse(heyRemember));
            }
            if (!binderCanCall.ParametersOk)
            {
                return(new ParametersErrorHeyResponse(heyRemember, binderCanCall.ParametersOkNum));
            }
            return(new BindingFailedHeyResponse(heyRemember));
        }
コード例 #5
0
        public IHeyResponse UpdateResponse(IScheduleType schedulePrototype)
        {
            IMethodBinder methodBinder = _resolveMethod.Find(_heyRemember);

            return(new HeyResponseFactory(methodBinder).Make(schedulePrototype, new CreatedHttpReturn()));
        }
コード例 #6
0
 public IHeyResponse Make(IScheduleType prototype)
 {
     return(Make(prototype, new CreatedHttpReturn()));
 }