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;
        }
Ejemplo n.º 3
0
 public Task SetAsync2(IDeploymentContext context, IDeploymentResource resource,
                       CancellationToken cancellationToken)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 4
0
 public int CompareTo(IDeploymentResource other)
 {
     return(string.Compare(Key, other.Key, StringComparison.Ordinal));
 }
Ejemplo n.º 5
0
 public Task SetAsync(IDeploymentContext context, IDeploymentResource resource,
                      CancellationToken cancellationToken)
 {
     BeenCalled = true;
     return(Task.FromResult(0));
 }