public override void Setup()
        {
            base.Setup();

            var commands = new[]
            {
                new CommandDescriptor("IdentityRunnable", String.Empty, Enumerable.Empty <ArgumentDescriptor>(), new[] { "IdentityRunnable" }),
                new CommandDescriptor("IncrementRunnable", String.Empty, new[]
                {
                    new ArgumentDescriptor
                    {
                        ArgumentType = typeof(Double),
                        ArgumentName = "value",
                        DefaultValue = 0,
                        IsOptional   = false,
                        Position     = 0
                    }
                }, new[] { "IncrementRunnable", "increment", "inc" })
            };

            var runnableFactory = new DefaultRunnableFactory(new[] { typeof(IdentityRunnable), typeof(IncrementRunnable) });

            var repository           = new MemoryDescriptorRepository(commandDescriptors: commands);
            var commandCallResolver  = new DefaultCommandCallResolver(repository, runnableFactory);
            var selectorManager      = new DefaultSelectorFactory();
            var nodeSelectorResolver = new DefaultSelectorResolver(selectorManager, repository);
            var runnableManager      = new DefaultRunnableManager();
            var executor             = new StandardExecutor(runnableManager);

            // initialize compiler and control flow factory
            ControlFlowFactory = new DefaultControlFlowFactory(commandCallResolver, nodeSelectorResolver, executor);
            Compiler           = new CodeQueryCompiler();
        }
Пример #2
0
        public override void Setup()
        {
            base.Setup();

            var runnableFactory = new DefaultRunnableFactory(new[] { typeof(ToUpperCaseRunnable), typeof(GetTextRunnable), typeof(ToStringRunnable) });

            var commands    = getCommandDescriptors();
            var selectors   = getSelectorDescriptors();
            var combinators = getCombinatorDescriptors();

            var descriptorRepository = new MemoryDescriptorRepository(selectors, combinators, commandDescriptors: commands);

            var commandCallResolver  = new DefaultCommandCallResolver(descriptorRepository, runnableFactory);
            var selectorManager      = new DefaultSelectorFactory();
            var nodeSelectorResolver = new DefaultSelectorResolver(selectorManager, descriptorRepository);
            var runnableManager      = new DefaultRunnableManager();
            var executor             = new StandardExecutor(runnableManager);

            // initialize compiler and control flow factory
            ControlFlowFactory = new DefaultControlFlowFactory(commandCallResolver, nodeSelectorResolver, executor);
            Compiler           = new CodeQueryCompiler();
        }