コード例 #1
0
        public void TestScanner()
        {
            using (CommandRegistry registry = new CommandRegistry(new RegistrySettings()))
            {
                ManualResetEvent mre = new ManualResetEvent(false);

                object output = null;
                registry.AddScanner(@"Scanner \w+ \d+", (IContextObject ctx, string match, LightweightParser parser, ref bool finalize) =>
                {
                    output = ScannerOutput;
                    mre.Set();
                    return(ScannerOutput);
                });

                registry.HandleInput("Scanner pattern 123", null, null);

                mre.WaitOne();

                Assert.AreEqual(output, ScannerOutput);
            }
        }