public IfBlockExecuter(WaitForTokenHandler waitForTokenHandler, WaitForReTokenHandler waitForReTokenHandler, MatchWaitTokenHandler matchWaitTokenHandler)
        {
            _tokenizer = new Tokenizer(TokenDefinitionRegistry.Default().Definitions());
            _tokenHandlers = new SimpleDictionary<string, ITokenHandler>();

            _tokenHandlers["exit"] = new ExitTokenHandler();
            _tokenHandlers["comment"] = new ContinueTokenHandler();
            _tokenHandlers["debuglevel"] = new DebugLevelTokenHandler();
            _tokenHandlers["var"] = new VarTokenHandler();
            _tokenHandlers["unvar"] = new UnVarTokenHandler();
            _tokenHandlers["hasvar"] = new HasVarTokenHandler();
            _tokenHandlers["goto"] = new GotoTokenHandler();
            _tokenHandlers["waitfor"] = waitForTokenHandler;
            _tokenHandlers["waitforre"] = waitForReTokenHandler;
            _tokenHandlers["pause"] = new PauseTokenHandler();
            _tokenHandlers["put"] = new SendCommandTokenHandler();
            _tokenHandlers["echo"] = new EchoTokenHandler();
            _tokenHandlers["match"] = new MatchTokenHandler();
            _tokenHandlers["matchre"] = new MatchTokenHandler();
            _tokenHandlers["matchwait"] = matchWaitTokenHandler;
            _tokenHandlers["save"] = new SaveTokenHandler();
            _tokenHandlers["move"] = new MoveTokenHandler();
            _tokenHandlers["nextroom"] = new NextroomTokenHandler();
            _tokenHandlers["send"] = new SendTokenHandler();
            _tokenHandlers["parse"] = new ParseTokenHandler();
            _tokenHandlers["containsre"] = new ContainsReTokenHandler();
            _tokenHandlers["gosub"] = new GoSubTokenHandler();
            _tokenHandlers["return"] = new ReturnTokenHandler();
        }
        public void SetUp()
        {
            theGameState = new StubGameState();
            theGameServer = new StubGameServer(theGameState);
            theScriptLog = new InMemoryScriptLog();
            theLocalVars = new SimpleDictionary<string, string>();

            theServices = new InMemoryServiceLocator();
            theServices.Add<IGameServer>(theGameServer);
            theServices.Add<IScriptLog>(theScriptLog);

            theScriptContext = new ScriptContext("1", "unvar", CancellationToken.None, theServices, theLocalVars);
            theHandler = new UnVarTokenHandler();
        }
        public CommandProcessor(IServiceLocator services, IVariableReplacer variableReplacer, IScriptLog scriptLog)
        {
            _services = services;
            _variableReplacer = variableReplacer;
            _scriptLog = scriptLog;
            _tokenizer = Tokenizer.With(TokenDefinitionRegistry.ClientCommands());

            _tokenHandlers = new SimpleDictionary<string, ITokenHandler>();
            _tokenHandlers["script"] = new ScriptTokenHandler();
            _tokenHandlers["scriptcommand"] = new ScriptCommandTokenHandler();
            _tokenHandlers["send"] = new SendTokenHandler();
            _tokenHandlers["globalvar"] = new GlobalVarTokenHandler();
            _tokenHandlers["parse"] = new ParseTokenHandler();
        }
        public void SetUp()
        {
            theGameState = new StubGameState();
            theGameServer = new StubGameServer(theGameState);

            theGameState.Set(ComponentKeys.Roundtime, "0");

            theLog = new InMemoryScriptLog();

            theReplacer = new VariableReplacer();
            theGameStream = new GameStream(theGameState);

            theServices = new InMemoryServiceLocator();
            theServices.Add<IGameServer>(theGameServer);
            theServices.Add<IGameState>(theGameState);
            theServices.Add<IScriptLog>(theLog);
            theServices.Add<IVariableReplacer>(theReplacer);
            theServices.Add<IIfBlockExecuter>(
                new IfBlockExecuter(
                    new WaitForTokenHandler(theGameState, theGameStream),
                    new WaitForReTokenHandler(theGameState, theGameStream),
                    new MatchWaitTokenHandler(theGameState, theGameStream)
                ));
            theServices.Add<IGameStream>(theGameStream);

            theCommandProcessor = new CommandProcessor(theServices, theReplacer, theLog);
            theServices.Add<ICommandProcessor>(theCommandProcessor);

            theLocalVars = new SimpleDictionary<string, string>();

            theScriptContext = new ScriptContext("1", "if", CancellationToken.None, theServices, theLocalVars);
            theScriptContext.DebugLevel = 5;

            theHandler = new IfTokenHandler();
        }
        public void SetUp()
        {
            theGameState = new StubGameState();
            theGameServer = new StubGameServer(theGameState);
            theScriptLog = new InMemoryScriptLog();
            theCommandProcessor = new StubCommandProcessor();

            theServices = new InMemoryServiceLocator();
            theServices.Add<IGameServer>(theGameServer);
            theServices.Add<IScriptLog>(theScriptLog);
            theServices.Add<ICommandProcessor>(theCommandProcessor);

            theLocalVars = new SimpleDictionary<string, string>();

            theScriptContext = new ScriptContext("1", "containsre", CancellationToken.None, theServices, theLocalVars);
            theScriptContext.DebugLevel = 5;
            theHandler = new ContainsReTokenHandler();
        }