本文整理汇总了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);
}
示例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);
}
示例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);
}