As you stated, the output indicates the synchronous processing, because it actually is a synchronous processing.
Defining Task does not mean asynchronous processing. There is no new Task creation, you only wrapped code to Task, but you did not create a new one.
If you want to test async processing, you should modify your method:
private Task<int> TestAsync()
{
return Task.Run(() =>
{
for (int i = 0; i < 20000; i++)
;
Console.WriteLine("Logic C");
return Task.FromResult(0);
});
}
To answer your another question:
You don't have desired output because your Main method is not waiting for asynchronous operation to finish. So as a execution in method TestAll goes to int value = await y; the main method will continue and will finish gracefully.
Update your Main method to wait for async task and you will get desired output:
static void Main(string[] args)
{
TestAll().Wait();
}
But look at synchronously waiting on asynchronous task problem. It is related to context threads (UI thread, ASP context thread,...) so it should be safe with Console app, but always good to know what is behind.