private void TestForRealCondition(string condition, Action <IRuleTriggerHandler, CommentTrigger> action)
        {
            var trigger = new CommentTrigger {
                Condition = condition
            };

            var handler = new CommentTriggerHandler(new JintScriptEngine(), userResolver);

            action(handler, trigger);
        }
        private void TestForRealCondition(string condition, Action <IRuleTriggerHandler, CommentTrigger> action)
        {
            var trigger = new CommentTrigger
            {
                Condition = condition
            };

            var memoryCache = new MemoryCache(Options.Create(new MemoryCacheOptions()));

            var handler = new CommentTriggerHandler(new JintScriptEngine(memoryCache), userResolver);

            action(handler, trigger);
        }
Exemplo n.º 3
0
        private void TestForRealCondition(string condition, Action <IRuleTriggerHandler, RuleContext> action)
        {
            var trigger = new CommentTrigger
            {
                Condition = condition
            };

            var realScriptEngine =
                new JintScriptEngine(new MemoryCache(Options.Create(new MemoryCacheOptions())),
                                     Options.Create(new JintScriptOptions
            {
                TimeoutScript    = TimeSpan.FromSeconds(2),
                TimeoutExecution = TimeSpan.FromSeconds(10)
            }));

            var handler = new CommentTriggerHandler(realScriptEngine, userResolver);

            action(handler, Context(trigger));
        }