コード例 #1
0
        public void CreateTestResult()
        {
            // Arrange.
            const string expectedTestName = "test name";
            var          cmdlet           = new InvokeTestCmdlet();

            // Act.
            var res = cmdlet.CreateTestResult(expectedTestName, true);

            // Assert.
            Assert.AreEqual(expectedTestName, res.TestName);
            Assert.IsTrue(res.Success);
        }
コード例 #2
0
        public void InvokeScriptBlock()
        {
            // Arrange.
            var runspace    = new RunspaceInvoke();
            var scriptBlock = (ScriptBlock)
                              runspace.Invoke("{$global:sb1=$true;123}")[0].BaseObject;
            var cmdlet = new InvokeTestCmdlet();

            // Act.
            var res = cmdlet.InvokeScriptBlock(scriptBlock);

            // Assert.
            Assert.AreEqual(123, (int)res[0].BaseObject);
            Assert.IsTrue((bool)runspace.Invoke("$sb1")[0].BaseObject);
        }