Exemplo n.º 1
0
        public void CLRMDModule_should_get_CLR_version()
        {
            Assert.AreEqual(4, IntPtr.Size, "Should be in a 32-bit test runner process.");

            using (var demoScope = new DemoProcessScope())
            using (var testScope = PowerShellWithClrMDModuleConnectedToProcess(demoScope.Process))
            {
                var shell = testScope.Shell;

                shell.AddCommand<GetClrVersionCmdlet>();
                var output = shell.Invoke();
                shell.Commands.Clear();

                Assert.AreEqual(1, output.Count);

                var version = (Version)output[0].BaseObject;
                Assert.AreEqual(4, version.Major);

                Assert.AreEqual(0, shell.Streams.Error.Count);
            }
        }
Exemplo n.º 2
0
        public void CLRMDModule_should_get_threads()
        {
            using (var demoScope = new DemoProcessScope())
            using (var testScope = PowerShellWithClrMDModuleConnectedToProcess(demoScope.Process))
            {
                var shell = testScope.Shell;

                shell.AddCommand<ConnectRuntimeCmdlet>();
                shell.Invoke();
                shell.Commands.Clear();

                shell.AddCommand<GetThreadCmdlet>();
                var output = shell.Invoke();
                shell.Commands.Clear();

                var clrThreads = output.Select(o => o.BaseObject).OfType<ClrThread>();

                Assert.AreNotEqual(0, clrThreads.Count(), "Should have threads.");

                Assert.AreEqual(0, shell.Streams.Error.Count);
            }
        }