public async Task SetAsync(IDeploymentContext context, IDeploymentResource resource, CancellationToken cancellationToken) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (resource == null) { throw new ArgumentNullException(nameof(resource)); } await _setAsyncDelegate(context, resource, cancellationToken); }
public async Task SetAsync(IDeploymentContext context, IDeploymentResource resource, CancellationToken cancellationToken) { var mockResource = (MockResource)resource; var startedIndex = Interlocked.Increment(ref _startedIndex); mockResource.StartedIndex = startedIndex; Console.WriteLine("Starting {0}", resource.Key); await Task.Delay(mockResource.Delay, cancellationToken); Console.WriteLine("Completed {0}", resource.Key); // Mark the order which the task completed var completedIndex = Interlocked.Increment(ref _completedIndex); mockResource.CompletedIndex = completedIndex; }
public Task SetAsync2(IDeploymentContext context, IDeploymentResource resource, CancellationToken cancellationToken) { throw new NotImplementedException(); }
public int CompareTo(IDeploymentResource other) { return(string.Compare(Key, other.Key, StringComparison.Ordinal)); }
public Task SetAsync(IDeploymentContext context, IDeploymentResource resource, CancellationToken cancellationToken) { BeenCalled = true; return(Task.FromResult(0)); }