示例#1
0
        public void TestWho()
        {
            var snippets = Startup.Create <Snippets>("Workspace");

            snippets.Compile(SNIPPETS.HelloQ);

            var whoMagic = new WhoMagic(snippets);
            var channel  = new MockChannel();

            // Check the workspace, it should be in error state:
            var response = whoMagic.Execute("", channel);
            var result   = response.Output as string[];

            PrintResult(response, channel);
            Assert.AreEqual(ExecuteStatus.Ok, response.Status);
            Assert.AreEqual(5, result.Length);
            Assert.AreEqual("HelloQ", result[0]);
            Assert.AreEqual("Tests.qss.NoOp", result[4]);
        }
        public async Task TestWho()
        {
            var snippets = Startup.Create <Snippets>("Workspace");
            await snippets.Workspace.Initialization;

            snippets.Compile(SNIPPETS.HelloQ);

            var whoMagic = new WhoMagic(snippets, new UnitTestLogger <WhoMagic>());
            var channel  = new MockChannel();

            // Check the workspace, it should be in error state:
            var response = await whoMagic.Execute("", channel);

            var result = response.Output as string[];

            PrintResult(response, channel);
            response.AssertIsOk();
            Assert.AreEqual(6, result?.Length);
            Assert.AreEqual("HelloQ", result?[0]);
            Assert.AreEqual("Tests.qss.NoOp", result?[4]);
        }