本文整理汇总了C#中Configuration.QueueBackgroundWork方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.QueueBackgroundWork方法的具体用法?C# Configuration.QueueBackgroundWork怎么用?C# Configuration.QueueBackgroundWork使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration.QueueBackgroundWork方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Background_tasks_that_return_disposables_have_their_disposables_disposed_with_the_Configuration
public void Background_tasks_that_return_disposables_have_their_disposables_disposed_with_the_Configuration()
{
var configuration = new Configuration();
var disposable = new BooleanDisposable();
configuration.QueueBackgroundWork(c => disposable);
configuration.StartBackgroundWork();
disposable.IsDisposed.Should().BeFalse();
configuration.Dispose();
disposable.IsDisposed.Should().BeTrue();
}
示例2: Background_work_cannot_not_be_started_more_than_once
public void Background_work_cannot_not_be_started_more_than_once()
{
var configuration = new Configuration();
var startCount = 0;
configuration.QueueBackgroundWork(c => Interlocked.Increment(ref startCount));
configuration.StartBackgroundWork();
configuration.StartBackgroundWork();
startCount.Should().Be(1);
}
示例3: Background_work_starts_when_StartBackgroundWork_is_called
public void Background_work_starts_when_StartBackgroundWork_is_called()
{
var configuration = new Configuration();
var started = false;
configuration.QueueBackgroundWork(c => { started = true; });
configuration.StartBackgroundWork();
started.Should().BeTrue();
}
示例4: Background_work_does_not_run_immediately_on_schedule
public void Background_work_does_not_run_immediately_on_schedule()
{
var configuration = new Configuration();
var started = false;
configuration.QueueBackgroundWork(c => { started = true; });
started.Should().BeFalse();
}