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


C# Job.GetAllPlugins方法代码示例

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


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

示例1: Should_Set_JobCommand_To_Finialize_When_All_Plugins_Are_Rolledback

        public void Should_Set_JobCommand_To_Finialize_When_All_Plugins_Are_Rolledback()
        {
            bool isRolledback = false;

            IJob job = new Job( DTO.JobData );
            job.JobRolledback += delegate
                                   {
                                       isRolledback = true;
                                   };

            foreach( IPlugin plugin in job.GetAllPlugins( ) )
            {
                plugin.BeginRollback();
            }

            Timing.WaitUntil(() => isRolledback, 2000);

            Assert.AreEqual( JobCommand.Finalize, job.CurrentCommand );
            Assert.IsTrue(isRolledback);
        }
开发者ID:CHAOS-ApS,项目名称:Octopus,代码行数:20,代码来源:JobTest.cs

示例2: Should_Return_Runable_Plugins_In_Reverse_Order_When_Rolling_Back

        public void Should_Return_Runable_Plugins_In_Reverse_Order_When_Rolling_Back()
        {
            IJob job = new Job(DTO.JobData);
            var errorPlugin = new TestPlugin(true,false,false);
            var hasFailed = false;

            job[job.Count - 1].Clear();
            job[job.Count - 1].Add(errorPlugin); //Error plugin added to the end

            job.JobExecuteFailed += (sender, eventArgs) => hasFailed = true;

            foreach (IPlugin plugin in job.GetAllPlugins())
            {
                plugin.BeginExecute();
            }

            Timing.WaitUntil(() => hasFailed, 2000);

            IList<IPlugin> plugins = job.GetRunablePlugins().ToList();

            Assert.AreEqual(JobCommand.Rollback, job.CurrentCommand);
            Assert.AreEqual(plugins.First(), errorPlugin);
            Assert.AreEqual(1, plugins.Count);

            foreach (var list in plugins)
            {
                list.BeginRollback();
            }

            IList<IPlugin> plugins2 = job.GetRunablePlugins().ToList();

            Assert.AreEqual(7, plugins2.Count);

            foreach (IPlugin list in plugins2)
            {
                list.BeginRollback();
            }

            IList<IPlugin> plugins3 = job.GetRunablePlugins().ToList();

            Assert.AreEqual(1, plugins3.Count);

            foreach (IPlugin list in plugins3)
            {
                list.BeginRollback();
            }

            IList<IPlugin> plugins4 = job.GetRunablePlugins().ToList();

            Assert.AreEqual(2, plugins4.Count);

            Assert.IsTrue(hasFailed);
        }
开发者ID:CHAOS-ApS,项目名称:Octopus,代码行数:53,代码来源:JobTest.cs

示例3: Should_Set_JobCommand_To_Commit_When_All_Plugins_Are_Executed

        public void Should_Set_JobCommand_To_Commit_When_All_Plugins_Are_Executed()
        {
            bool isExecuted = false;

            IJob job = new Job( DTO.JobData );
            job.JobExecuted += delegate
                                   {
                                       isExecuted = true;
                                   };

            foreach( IPlugin plugin in job.GetAllPlugins( ) )
            {
                plugin.BeginExecute();
            }

            Timing.WaitUntil(() => isExecuted, 2000);

            Assert.AreEqual( JobCommand.Commit, job.CurrentCommand );
            Assert.IsTrue(isExecuted);
        }
开发者ID:CHAOS-ApS,项目名称:Octopus,代码行数:20,代码来源:JobTest.cs


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