private static int TestChoice()
{
	Console.WriteLine("Type test 1,2,3 or 4: ");

	int testId = Convert.ToInt32(Console.ReadLine());

	return testId;
}

*********

private static async void Run(int testID)
{
	switch(testID) 
	{
		case 1:
			await RunIt();
			break;
		case 2:
			await RunItFaster();
			break;
		case 3:
			await RunItEvenFasterV1();
			break;
		case 4:
			await RunItEvenFasterV2();
			break;
	}
}

*********

private static async Task<string> RunIt()
{
    var start = DateTime.Now;

    Console.WriteLine("[{0}] START ", start);
    
    var tasktorun = new TasksToRun();

    await tasktorun.MonitorServer(2000);
    await tasktorun.SendMail(2000);
    await tasktorun.DownloadFile(2000);

    var end = DateTime.Now;

    Console.WriteLine("[{0}] END ", end);
    Console.WriteLine("Elapsed time : {0} ", end - start);

    return "Done";
}

*********

private static async Task<string> RunItFaster()
{
	var start = DateTime.Now;

	Console.WriteLine("[{0}] START ", start);

	var tasktorun = new TasksToRun();

	tasktorun.MonitorServer(2000);

	await tasktorun.SendMail(2000);
	await tasktorun.DownloadFile(2000);

	var end = DateTime.Now;

	Console.WriteLine("[{0}] END ", end);
	Console.WriteLine("Elapsed time : {0} ", end - start);

	return "Done";
}

*********

private static async Task<string> RunItEvenFasterV1()
{
	var start = DateTime.Now;

	Console.WriteLine("[{0}] START ", start);

	var tasktorun = new TasksToRun();

	var monitorServer = tasktorun.MonitorServer(2000);
	var emailToSend = tasktorun.SendMail(2000);
	var randomInt =  tasktorun.DownloadFile(2000);

	var all = Task.WhenAll(monitorServer, emailToSend, randomInt);

	await all;

	var end = DateTime.Now;

	Console.WriteLine("[{0}] END ", end);
	Console.WriteLine("Elapsed time : {0} ", end - start);

	return "Done";
}

*********

private static async Task<string> RunItEvenFasterV2()
{
	var start = DateTime.Now;

	Func<int, Task<string>> target = null;

	Console.WriteLine("[{0}] START ", start);

	var tasktorun = new TasksToRun();

	target = tasktorun.MonitorServer;
	target += tasktorun.SendMail;
	target += tasktorun.DownloadFile;

	var all = Task.WhenAll(target(2000));

	await all;

	var end = DateTime.Now;

	Console.WriteLine("[{0}] END ", end);
	Console.WriteLine("Elapsed time : {0} ", end - start);

	return "Done";
}

*********

public class TasksToRun
{
	public Task<string> MonitorServer(int ms)
	{
		Console.WriteLine("Enter MonitorServer()");

		return Task.Delay(ms).ContinueWith(_=>"Leave MonitorServer");
		
	}

	public async Task<string> SendMail(int ms)
	{
		Console.WriteLine("Enter SendMail()");

		return await Task.Delay(ms).ContinueWith(_ => "Leave SendMail");
	}

	public async Task<string> DownloadFile(int ms)
	{
		Console.WriteLine("Enter DownloadFile()");

		return await Task.Delay(ms).ContinueWith(_ => "Leave DownloadFile");
	}
}