Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

Loop an async method

$
0
0

In my test project, I want to run several async methods in a loop, Test() below.

When I run the following TestLoop() method, the method Test() is only run once with no errors.

How do I get the loop to continue through all 10 iterations??

[TestMethod]
    public async Task TestLoop()
    {
        int intTotalTests = 10;

        for (int i = 0; i <= intTotalTests; i++)
        {
            await myTest();
        }
    }


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>