本文整理汇总了C#中BeforePipeline.AddItemToEndOfPipeline方法的典型用法代码示例。如果您正苦于以下问题:C# BeforePipeline.AddItemToEndOfPipeline方法的具体用法?C# BeforePipeline.AddItemToEndOfPipeline怎么用?C# BeforePipeline.AddItemToEndOfPipeline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BeforePipeline
的用法示例。
在下文中一共展示了BeforePipeline.AddItemToEndOfPipeline方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Pipeline_containing_another_pipeline_will_invoke_items_in_both_pipelines
public void Pipeline_containing_another_pipeline_will_invoke_items_in_both_pipelines()
{
// Given
var item1Called = false;
Func<NancyContext, Response> item1 = (r) => { item1Called = true; return null; };
var item2Called = false;
Func<NancyContext, Response> item2 = (r) => { item2Called = true; return null; };
var item3Called = false;
Func<NancyContext, Response> item3 = (r) => { item3Called = true; return null; };
var item4Called = false;
Func<NancyContext, Response> item4 = (r) => { item4Called = true; return null; };
pipeline += item1;
pipeline += item2;
var subPipeline = new BeforePipeline();
subPipeline += item3;
subPipeline += item4;
// When
pipeline.AddItemToEndOfPipeline(subPipeline);
pipeline.Invoke(CreateContext(), new CancellationToken());
// Then
Assert.True(item1Called);
Assert.True(item2Called);
Assert.True(item3Called);
Assert.True(item4Called);
}
示例2: PlusEquals_with_another_pipeline_adds_those_pipeline_items_to_end_of_pipeline
public void PlusEquals_with_another_pipeline_adds_those_pipeline_items_to_end_of_pipeline()
{
// Given
pipeline.AddItemToEndOfPipeline(r => null);
pipeline.AddItemToEndOfPipeline(r => CreateResponse());
var pipeline2 = new BeforePipeline();
pipeline2.AddItemToEndOfPipeline(r => null);
pipeline2.AddItemToEndOfPipeline(r => CreateResponse());
// When
pipeline += pipeline2;
// Then
Assert.Equal(4, pipeline.PipelineItems.Count());
Assert.Same(pipeline2.PipelineDelegates.ElementAt(0), pipeline.PipelineDelegates.ElementAt(2));
Assert.Same(pipeline2.PipelineDelegates.ElementAt(1), pipeline.PipelineDelegates.Last());
}
示例3: PlusEquals_with_another_pipeline_adds_those_pipeline_items_to_end_of_pipeline
public void PlusEquals_with_another_pipeline_adds_those_pipeline_items_to_end_of_pipeline()
{
Func<NancyContext, Response> item1 = (r) => { return null; };
Func<NancyContext, Response> item2 = (r) => { return CreateResponse(); };
pipeline.AddItemToEndOfPipeline(item1);
pipeline.AddItemToEndOfPipeline(item2);
Func<NancyContext, Response> item3 = (r) => { return null; };
Func<NancyContext, Response> item4 = (r) => { return CreateResponse(); };
var pipeline2 = new BeforePipeline();
pipeline2.AddItemToEndOfPipeline(item3);
pipeline2.AddItemToEndOfPipeline(item4);
pipeline += pipeline2;
Assert.Equal(4, pipeline.PipelineDelegates.Count());
Assert.Same(item3, pipeline.PipelineDelegates.ElementAt(2));
Assert.Same(item4, pipeline.PipelineDelegates.Last());
}