using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Net45.UnitTests.Samples.Jv { public class ClassUnderTest { public static int? taskId; public static string taskName; public static int result; public async Task AddWithTask(int a, int b) { await Task.Factory.StartNew(async () => { taskName = "AddWithTask"; taskId = Task.CurrentId; result = await add(a, b); }); return result; } public async Task add(int a, int b) { int x = 0; Task.Factory.StartNew( ()=> { x = a + b; taskId = Task.CurrentId; System.Threading.Thread.Sleep(20); }); return x; } public async Task returnAdditionResult(int a, int b) { int x = 0; x = await add(a, b); return a+b; } } }