Пример #1
0
        public void SetUp()
        {
            theLog = new InMemoryScriptLog();
            theGameState = new StubGameState();
            theGameServer = new StubGameServer(theGameState);
            theGameStream = new GameStream(theGameState);

            theServices = new InMemoryServiceLocator();
            theServices.Add<IGameServer>(theGameServer);
            theServices.Add<IGameState>(theGameState);
            theServices.Add<IScriptLog>(theLog);
            theServices.Add<IVariableReplacer>(new VariableReplacer());
            theServices.Add<ICommandProcessor>(new CommandProcessor(theServices, theServices.Get<IVariableReplacer>(), theLog));
            theServices.Add<IIfBlocksParser>(new IfBlocksParser());
            var waitFor = new WaitForTokenHandler(theGameState, theGameStream);
            var waitForRe = new WaitForReTokenHandler(theGameState, theGameStream);
            var matchWait = new MatchWaitTokenHandler(theGameState, theGameStream);
            theServices.Add<WaitForTokenHandler>(waitFor);
            theServices.Add<WaitForReTokenHandler>(waitForRe);
            theServices.Add<MatchWaitTokenHandler>(matchWait);
            theServices.Add<IIfBlockExecuter>(new IfBlockExecuter(waitFor, waitForRe, matchWait));
            theServices.Add<IGameStream>(theGameStream);

            theScript = new Script(theServices, Tokenizer.With(TokenDefinitionRegistry.Default()));
        }
Пример #2
0
        public void SetUp()
        {
            theGameState = new StubGameState();
            theLocator = new InMemoryServiceLocator();
            theLogger = new NullLog();

            theSocket = new StubAsyncSocket();

            theLocator.Add<IAsyncSocket>(theSocket);

            theGameServer = new SimpleGameServer(theGameState, theLogger, theLocator);
        }
        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 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);

            theScriptContext = new ScriptContext("1", "gototoken", CancellationToken.None, theServices, null);
            theScriptContext.DebugLevel = 5;
            theHandler = new GotoTokenHandler();
        }
        public void SetUp()
        {
            theGameState = new StubGameState();
            theGameServer = new StubGameServer(theGameState);
            theGameStream = new GameStream(theGameState);

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

            theLog = new InMemoryScriptLog();

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

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

            theHandler = new WaitForReTokenHandler(theGameState, theGameStream);
        }
        public void SetUp()
        {
            theGameState = new StubGameState();
            theGameServer = new StubGameServer(theGameState);
            theLogger = new InMemoryScriptLog();
            theGameStream = new GameStream(theGameState);

            theServices = new InMemoryServiceLocator();
            theServices.Add<IGameServer>(theGameServer);
            theServices.Add<IGameState>(theGameState);
            theServices.Add<IScriptLog>(theLogger);
            theServices.Add<IVariableReplacer>(new VariableReplacer());
            theServices.Add<ICommandProcessor>(new CommandProcessor(theServices, theServices.Get<IVariableReplacer>(), theLogger));
            theServices.Add<IGameStream>(theGameStream);

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

            theHandler = new SendCommandTokenHandler();
        }
Пример #7
0
        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();
        }
Пример #8
0
 public StubGameServer(StubGameState gameState)
 {
     _gameState = gameState;
 }
Пример #9
0
        public void SetUp()
        {
            theScript = new StubScript();
            theLoader = new StubScriptLoader();
            theLogger = new InMemoryScriptLog();

            theGameState = new StubGameState();
            theGameServer = new StubGameServer(theGameState);

            theReplacer = new VariableReplacer();

            theServices = new InMemoryServiceLocator();

            theGameStream = new GameStream(theGameState);

            var waitForTokenHandler = new WaitForTokenHandler(theGameState, theGameStream);
            var waitForReTokenHandler = new WaitForReTokenHandler(theGameState, theGameStream);
            var matchWaitTokenHandler = new MatchWaitTokenHandler(theGameState, theGameStream);

            theServices.Add<IGameServer>(theGameServer);
            theServices.Add<IGameState>(theGameState);
            theServices.Add<IScriptLog>(theLogger);
            theServices.Add<ICommandProcessor>(new CommandProcessor(theServices, theReplacer, theLogger));
            theServices.Add<IVariableReplacer>(theReplacer);
            theServices.Add<IIfBlocksParser>(new IfBlocksParser());
            theServices.Add<WaitForTokenHandler>(waitForTokenHandler);
            theServices.Add<WaitForReTokenHandler>(waitForReTokenHandler);
            theServices.Add<MatchWaitTokenHandler>(matchWaitTokenHandler);
            theServices.Add<IIfBlockExecuter>(new IfBlockExecuter(waitForTokenHandler, waitForReTokenHandler, matchWaitTokenHandler));

            theRunner = new ScriptRunner(theServices, theLoader, theLogger);

            theRunner.Create = () => theScript;
        }
Пример #10
0
        public void SetUp()
        {
            theGameState = new StubGameState();
            theGameServer = new StubGameServer(theGameState);

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

            theScriptLog = new InMemoryScriptLog();

            theRunner = new StubScriptRunner();
            theServices = new InMemoryServiceLocator();

            theServices.Add<IGameServer>(theGameServer);
            theServices.Add<IGameState>(theGameState);
            theServices.Add<IScriptRunner>(theRunner);
            theServices.Add<IVariableReplacer>(theVariableReplacer);
            theServices.Add<IGameStream>(theGameStream);

            theProcessor = new CommandProcessor(theServices, theVariableReplacer, theScriptLog);
        }
        public void SetUp()
        {
            theGameState = new StubGameState();
            theGameServer = new StubGameServer(theGameState);
            theLogger = new InMemoryScriptLog();
            theCancelSource = new CancellationTokenSource();

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

            theServices = new InMemoryServiceLocator();
            theServices.Add<IGameServer>(theGameServer);
            theServices.Add<IGameState>(theGameState);
            theServices.Add<IScriptLog>(theLogger);

            theScriptContext = new ScriptContext("1", "pausetoken", theCancelSource.Token, theServices, null);

            theHandler = new PauseTokenHandler();
        }
        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();
        }
Пример #13
0
        public void SetUp()
        {
            theReplacer = new VariableReplacer();
            theLocator = new InMemoryServiceLocator();
            theGameState = new StubGameState();
            theVars = new SimpleDictionary<string, string>();
            theContext = new ScriptContext("1", "Name", CancellationToken.None, theLocator, theVars);

            theLocator.Add<IGameState>(theGameState);
        }