public void ShouldThrowIfCancellationRequestedWhenSettingCheckpoint() { // Arrange using var cancellationSource = new CancellationTokenSource(); var token = cancellationSource.Token; cancellationSource.Cancel(); // Act/Assert Should.Throw <TaskCanceledException>(async() => await _sut.SetCheckpoint(CheckpointName, Checkpoint, token).ConfigureAwait(false)); }
protected Task SetCheckpoint(long?checkpoint, CancellationToken cancellationToken) { _checkpoint = checkpoint; return(_checkpoint.HasValue ? _checkpointManager.SetCheckpoint(CheckpointName, _checkpoint.Value, cancellationToken) : _checkpointManager.ClearCheckpoint(CheckpointName, cancellationToken)); }