当前位置: 首页>>代码示例>>C#>>正文


C# Pipeline.Execute方法代码示例

本文整理汇总了C#中Pipeline.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# Pipeline.Execute方法的具体用法?C# Pipeline.Execute怎么用?C# Pipeline.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pipeline的用法示例。


在下文中一共展示了Pipeline.Execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            var prefilterPump = new OrderSource();
            var prefilterSink = new OrderSink();

            var prefilter = new Pipeline<Order>(prefilterPump, prefilterSink, "prefiltering")
                .Register(new CalculateSubtotal() { Name = "Subtotal calculator" })
                .Register(new CalculateTax() { Name = "Tax calculator" })
                .Register(new CalculateTotal() { Name = "Total calculator" })
                ;

            prefilter.Execute();

            Console.WriteLine("".PadRight(50, '='));
            foreach (var input in prefilterSink.Orders)
            {
                var result = string.Format("{0}  {1:C}  {2}  {3:C}  {4:C}  {5:C}",
                    input.Name.PadRight(10),
                    input.Price,
                    input.Quantity,
                    input.Subtotal,
                    input.Tax,
                    input.Total
                );
                Console.WriteLine(result);
            }
            Console.WriteLine("".PadRight(50, '='));

            Console.ReadKey();
        }
开发者ID:nathanchere,项目名称:Spikes_Pipeline,代码行数:30,代码来源:Program.cs

示例2: Should_throw_exception_when_chain_goes_too_far

		public void Should_throw_exception_when_chain_goes_too_far()
		{
			var pipeline = new Pipeline<int, string>();
			pipeline.Add(new AddToInput(3));

			Assert.Throws<EndOfChainException>(() => pipeline.Execute(2));
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:7,代码来源:FinallyTests.cs

示例3: Main

        static void Main(string[] args)
        {
            var pump = new FileDataSource(new StreamReader(@"data\TestData.txt"));
            var shifter = new CircularShifter();
            var alphabetizer = new Alphabetizer();

            #region Modifying the requirement - add a 'noise' list to remove words from the index

            //var noiseWords = new FileDataSource(new StreamReader(@"data\noise.txt")).Begin();
            //var noiseRemover = new NoiseRemoval(noiseWords);
            //pump.Successor = noiseRemover;
            //noiseRemover.Successor = shifter;

            #endregion

            pump.Successor = shifter;
            shifter.Successor = alphabetizer;

            var pipeline = new Pipeline<string>(pump: pump, sink: new ConsoleWriter());
            Console.WriteLine("Begin Execution At:{0}", DateTime.UtcNow);
            pipeline.Execute();
            Console.WriteLine("Stop Execution At:{0}", DateTime.UtcNow);

            Console.WriteLine("Press any key to continue");
            Console.ReadKey();
        }
开发者ID:uzigula,项目名称:Styles,代码行数:26,代码来源:Program.cs

示例4: CalculateSpamScore2

		public double CalculateSpamScore2(string text)
		{
			var pipeline = new Pipeline<string, double>()
				.AddAssembly()
				.AddNamespace("Tamarack.Example.Pipeline.SpamScorer.Filters")
				.AddConfigurationSection("spamScoreFilters");

			return pipeline.Execute(text);
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:9,代码来源:SpamScorer.cs

示例5: Should_execute_final_function

		public void Should_execute_final_function()
		{
			var pipeline = new Pipeline<int, string>();
			pipeline.Finally(x => x + "!");

			var output = pipeline.Execute(2);

			Assert.That(output, Is.EqualTo("2!"));
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:9,代码来源:FinallyTests.cs

示例6: Should_not_require_final_function_when_chain_short_circuits

		public void Should_not_require_final_function_when_chain_short_circuits()
		{
			var pipeline = new Pipeline<int, string>();
			pipeline.Add(new ShortCircuit());

			var output = pipeline.Execute(2);

			Assert.That(output, Is.EqualTo("2"));
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:9,代码来源:FinallyTests.cs

示例7: CalculateSpamScore

		public double CalculateSpamScore(string text)
		{
			var pipeline = new Pipeline<string, double>()
				.Add<SpamCopBlacklistFilter>()
				.Add<PerspcriptionDrugFilter>()
				.Add<PornographyFilter>()
				.Finally(score => 0);

			return pipeline.Execute(text);
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:10,代码来源:SpamScorer.cs

示例8: Filter_can_modify_output

		public void Filter_can_modify_output()
		{
			var pipeline = new Pipeline<int, string>();
			pipeline.Add(new AppendToOutput("#"));
			pipeline.Finally(x => x + "!");

			var output = pipeline.Execute(2);

			Assert.That(output, Is.EqualTo("2!#"));
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:10,代码来源:PipelineFuncTests.cs

示例9: Should_load_filters_in_namespace_in_alphabetical_order

		public void Should_load_filters_in_namespace_in_alphabetical_order()
		{
			var pipeline = new Pipeline<int, string>()
				.AddNamespace("Tamarack.Test.Pipeline.Extensions")
				.Finally(x => x.ToString());

			var output = pipeline.Execute(2);

			Assert.That(output, Is.EqualTo("2*^"));
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:10,代码来源:AddFiltersInAssemblyTests.cs

示例10: Login

		public bool Login(string username, string password)
		{
			var pipeline = new Pipeline<LoginContext, bool>(serviceProvider)
				.Add<WriteLoginAttemptToAuditLog>()
				.Add<LockoutOnConsecutiveFailures>()
				.Add<AuthenticateAgainstLocalStore>()
				.Add<AuthenticateAgainstLdap>()
				.Finally(c => false);

			return pipeline.Execute(new LoginContext(username, password));
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:11,代码来源:LoginService.cs

示例11: Should_apply_each_filter_in_order_added

		public void Should_apply_each_filter_in_order_added()
		{
			var pipeline = new Pipeline<int, string>();
			pipeline.Add(new AddToInput(2));
			pipeline.Add(new AppendToOutput("@"));
			pipeline.Finally(x => x + "!");

			var output = pipeline.Execute(2);

			Assert.That(output, Is.EqualTo("[email protected]"));
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:11,代码来源:PipelineFuncTests.cs

示例12: Submit

		public int Submit(Post post)
		{
			var pipeline = new Pipeline<Post, int>()
				.Add(new CanoncalizeHtml())
				.Add(new StripMaliciousTags())
				.Add(new RemoveJavascript())
				.Add(new RewriteProfanity())
				.Add(new GuardAgainstDoublePost())
				.Finally(p => repository.Save(p));

			var newId = pipeline.Execute(post);

			return newId;
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:14,代码来源:BlogEngine.cs

示例13: StringWith_RunDate_ReturnsEmpty

        public void StringWith_RunDate_ReturnsEmpty()
        {
            var input = "Run_Date";
            Pipeline<string> pipeline = new Pipeline<string>();
            string result = pipeline.Register(new IdFilter())
                .Register(new NameFilter())
                .Register(new RunDateFilter())
                .Execute(input);

            Assert.AreEqual(string.Empty, result);

            input = "Run Date";
            result = pipeline
                .Execute(input);

            Assert.AreEqual(string.Empty, result);

        }
开发者ID:yuyi1,项目名称:Verdezyne-Operations,代码行数:18,代码来源:FilterPipelineTest.cs

示例14: FilterNh4

        public void FilterNh4()
        {
            var input = "NH4+ / NH3";
            Pipeline<string> pipeline = new Pipeline<string>();
            string result = pipeline.Register(new NH4Filter())
                .Execute(input);
            Assert.AreEqual("NH4+/NH3", result);

            input = @"NH₄⁺/NH₃";
            result = pipeline.Execute(input);
            Assert.AreEqual("NH4+/NH3", result);

            input = @"NH3 & NH4";
            result = pipeline.Execute(input);
            Assert.AreEqual("NH4+/NH3", result);
        }
开发者ID:yuyi1,项目名称:Verdezyne-Operations,代码行数:16,代码来源:FilterPipelineTest.cs

示例15: Should_throw_exception_when_no_filters_exist

		public void Should_throw_exception_when_no_filters_exist()
		{
			var pipeline = new Pipeline<int, string>();

			Assert.Throws<EndOfChainException>(() => pipeline.Execute(2));
		}
开发者ID:JadonCheung,项目名称:tamarack,代码行数:6,代码来源:FinallyTests.cs


注:本文中的Pipeline.Execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。