示例#1
0
        public static Task <TResult> Run <TResult>(Func <Task <TResult> > function, CancellationToken cancellationToken)
        {
            if (CoyoteRuntime.IsExecutionControlled)
            {
                var runtime = CoyoteRuntime.Current;
                var task    = runtime.ScheduleFunction(function, null, cancellationToken);
                return(runtime.UnwrapTask(task));
            }

            return(Task.Run(FuzzingProvider.CreateFunc(function), cancellationToken));
        }
示例#2
0
 public static Task Run(Action action, CancellationToken cancellationToken) => CoyoteRuntime.IsExecutionControlled ?
 CoyoteRuntime.Current.ScheduleAction(action, null, OperationContext.CreateOperationExecutionOptions(),
                                      false, cancellationToken) :
 Task.Run(FuzzingProvider.CreateAction(action), cancellationToken);
示例#3
0
 public static Task Delay(TimeSpan delay, CancellationToken cancellationToken) => CoyoteRuntime.IsExecutionControlled ?
 CoyoteRuntime.Current.ScheduleDelay(delay, cancellationToken) :
 Task.Delay(FuzzingProvider.CreateDelay(delay), cancellationToken);
示例#4
0
 public static Task Delay(TimeSpan delay) => CoyoteRuntime.IsExecutionControlled ?
 CoyoteRuntime.Current.ScheduleDelay(delay, default) : Task.Delay(FuzzingProvider.CreateDelay(delay));
示例#5
0
 public static Task Delay(int millisecondsDelay, CancellationToken cancellationToken) => CoyoteRuntime.IsExecutionControlled ?
 CoyoteRuntime.Current.ScheduleDelay(TimeSpan.FromMilliseconds(millisecondsDelay), cancellationToken) :
 Task.Delay(FuzzingProvider.CreateDelay(millisecondsDelay), cancellationToken);
示例#6
0
 public static Task Delay(int millisecondsDelay) => CoyoteRuntime.IsExecutionControlled ?
 CoyoteRuntime.Current.ScheduleDelay(TimeSpan.FromMilliseconds(millisecondsDelay), default) :
 Task.Delay(FuzzingProvider.CreateDelay(millisecondsDelay));
示例#7
0
 public static Task <TResult> Run <TResult>(Func <TResult> function, CancellationToken cancellationToken) =>
 CoyoteRuntime.IsExecutionControlled ?
 CoyoteRuntime.Current.ScheduleFunction(function, null, cancellationToken) :
 Task.Run(FuzzingProvider.CreateFunc(function), cancellationToken);