static void Main(string[] args)
        {
            var cts = new CancellationTokenSource(1000);
            var tcs = new TaskCompletionSource <object>();

            var taskWithCancellation = tcs.TaskWithCancellation(cts.Token);

            try
            {
                TestAsync(taskWithCancellation, cts.Token).Wait();
            }
            catch (AggregateException ex)
            {
                Console.WriteLine(ex.InnerException.Message);
            }
            Console.ReadLine();
        }