I need to run a test on some code for 2 hours. I'm using four async Task methods and in stead of calling all at once each time I would like to call two one time, then one the next time, then all four the next time, and so on, so on, so on, ect..
It does not matter which ones get called I just need to mix up the calls each time and not call all of the methods each time.
I need to know how to set up a timer so after 2 hours is up it will stop and a way to mix up the method calls.
The code I'm looking for would go in the static void Main(string[] args){}
Basically I need some type of loop.
class Program
{
static void Main(string[] args)
{
}
static async Task Test1()
{
int[] elevIds = new int[] { 4440, 4441, 4442 };
IElevation[] elevs = new IElevation[3];
elevs = await Task.WhenAll(Enumerable.Range(0, elevs.Length).Select(i => AlumCloudPlans.Manager.GetElevationAsync(elevIds[i])));
using (var pdf = await AlumCloudPlans.Manager.RollUpProjectPDFAsync(new Guid("da91dc34-fa29-4abd-bcc0-d04408310e3e"), elevs, true))
{
using (var ms = new MemoryStream()) { pdf.Save(ms, false); }
}
}
static async Task Test2()
{
int[] elevIds = new int[] { 4430, 4431, 4434, 4435 };
IElevation[] elevs = new IElevation[4];
elevs = await Task.WhenAll(Enumerable.Range(0, elevs.Length).Select(i => AlumCloudPlans.Manager.GetElevationAsync(elevIds[i])));
using (var pdf = await AlumCloudPlans.Manager.RollUpProjectPDFAsync(new Guid("da91dc34-fa29-4abd-bcc0-d04408310e3e"), elevs, true))
{
using (var ms = new MemoryStream()) { pdf.Save(ms, false); }
}
}
static async Task Test3()
{
int[] elevIds = new int[] { 4427 };
IElevation[] elevs = new IElevation[1];
elevs = await Task.WhenAll(Enumerable.Range(0, elevs.Length).Select(i => AlumCloudPlans.Manager.GetElevationAsync(elevIds[i])));
using (var pdf = await AlumCloudPlans.Manager.RollUpProjectPDFAsync(new Guid("da91dc34-fa29-4abd-bcc0-d04408310e3e"), elevs, true))
{
using (var ms = new MemoryStream()) { pdf.Save(ms, false); }
}
}
static async Task Test4()
{
int[] elevIds = new int[] { 2282, 4309 };
IElevation[] elevs = new IElevation[2];
elevs = await Task.WhenAll(Enumerable.Range(0, elevs.Length).Select(i => AlumCloudPlans.Manager.GetElevationAsync(elevIds[i])));
using (var pdf = await AlumCloudPlans.Manager.RollUpProjectPDFAsync(new Guid("da91dc34-fa29-4abd-bcc0-d04408310e3e"), elevs, true))
{
using (var ms = new MemoryStream()) { pdf.Save(ms, false); }
}
}
}
}