Task of Head Result and Task for Remain
public void TestRun()
{
var task = new HrTask<int, int[]>(() => {
return (
1,
() => new int[] { 2, 3 }
);
});
task.Start();
var result = task.Result;
Assert.AreEqual(result.headResult, 1);
var remainResult = result.remainTask.Result;
CollectionAssert.AreEqual(remainResult, new int[] { 2, 3 });
}
public async Task TestAsync()
{
var task = new HrTask<int, int[]>(() => {
return (
1,
() => new int[] { 2, 3 }
);
});
task.Start();
var result = await task;
Assert.AreEqual(result.headResult, 1);
var remainResult = await result.remainTask;
CollectionAssert.AreEqual(remainResult, new int[] { 2, 3 });
}