Represents the base functionality of a pipeline that can be used to invoke commands.
Pipelines are created within the context of a runspace. Pipelines can be created using the following methods: IRunspace.CreatePipeline: Overloaded method that can be used to create a pipeline or to create a pipeline with a valid command string. IRunspace.CreateNestedPipeline: Overloaded method that can be used to create a nested pipeline or to create a nested pipeline with a valid command string.
Inheritance: IPipeline
示例#1
0
        public void CtorSavesPipelineReference()
        {
            // Arrange.
            var expectedPipeline = RunspaceFactory
                .CreateRunspace()
                .CreatePipeline();

            // Act.
            var wrapper = new PipelineWrapper(expectedPipeline);

            // Assert.
            Assert.AreEqual(expectedPipeline, wrapper.Pipeline);
        }
示例#2
0
        public void InvokeDelegatesToWrappedPipeline()
        {
            // Arrange.
            var runspace = RunspaceFactory.CreateRunspace();
            runspace.Open();
            var expectedPipeline = runspace.CreatePipeline("1+1");
            var wrapper = new PipelineWrapper(expectedPipeline);

            // Act.
            var res = wrapper.Invoke();

            // Assert.
            Assert.AreEqual(2, (int)res[0].BaseObject);
        }