Using Moq to verify calls are made in the correct order

There is bug when using MockSequence on same mock. It definitely will be fixed in later releases of Moq library (you can also fix it manually by changing Moq.MethodCall.Matches implementation). If you want to use Moq only, then you can verify method call order via callbacks: int callOrder = 0; writerMock.Setup(x => x.Write(expectedType)).Callback(() => Assert.That(callOrder++, … Read more

Resolve promises one after another (i.e. in sequence)?

Update 2017: I would use an async function if the environment supports it: async function readFiles(files) { for(const file of files) { await readFile(file); } }; If you’d like, you can defer reading the files until you need them using an async generator (if your environment supports it): async function* readFiles(files) { for(const file of … Read more