public void OneArg() { var args = new RantPatternArgs { ["foo"] = "Bar" }; Assert.AreEqual("FooBar", rant.Do(@"Foo[in:foo]", 0, 0, args).Main); }
public void OneArgAnonymousType() { var args = new { msg = "Hello World" }; Assert.AreEqual("Hello World", rant.Do(@"[in:msg]", 0, 0, RantPatternArgs.CreateFrom(args)).Main); }
public Sandbox(RantEngine engine, RantPattern pattern, RNG rng, int sizeLimit = 0, RantPatternArgs args = null) { _engine = engine; _format = engine.Format; _sizeLimit = new Limit(sizeLimit); _baseOutput = new OutputWriter(this); _outputs = new Stack <OutputWriter>(); _outputs.Push(_baseOutput); _rng = rng; _startingGen = rng.Generation; _pattern = pattern; _objects = new ObjectStack(engine.Objects); _blocks = new Stack <BlockState>(); _matches = new Stack <Match>(); _queryState = new QueryState(); _subroutineArgs = new Stack <Dictionary <string, RantAction> >(); _syncManager = new SyncManager(this); _blockManager = new BlockManager(); _scriptObjectStack = new Stack <object>(); _patternArgs = args; _stopwatch = new Stopwatch(); }
public Sandbox(RantEngine engine, RantPattern pattern, RNG rng, int sizeLimit = 0, RantPatternArgs args = null) { _engine = engine; _format = engine.Format; _sizeLimit = new Limit(sizeLimit); _baseOutput = new OutputWriter(this); _outputs = new Stack<OutputWriter>(); _outputs.Push(_baseOutput); _rng = rng; _startingGen = rng.Generation; _pattern = pattern; _objects = new ObjectStack(engine.Objects); _blocks = new Stack<BlockState>(); _matches = new Stack<Match>(); _queryState = new QueryState(); _subroutineArgs = new Stack<Dictionary<string, RantAction>>(); _syncManager = new SyncManager(this); _blockManager = new BlockManager(); _scriptObjectStack = new Stack<object>(); _patternArgs = args; _stopwatch = new Stopwatch(); }
public void CustomArgsClass() { var args = new TestCustomArgsClass { A = "Hello", B = "World" }; Assert.AreEqual("Hello World!", rant.Do(@"[in:word-a] [in:word-b]!", 0, 0, RantPatternArgs.CreateFrom(args)).Main); }