Tests.MsgLoopTests.CanInterceptMessages C# (CSharp) Method

CanInterceptMessages() private method

private CanInterceptMessages ( ) : void
return void
        public void CanInterceptMessages() => AsyncContext.Run(async () =>
        {
            var i = 0;

            using (var loop = new MessageLoop<int>(() => 0, interceptor: async (s, ctx) =>
            {
                i++;
                try
                {
                    var result = await ctx.Func(s);
                    return result;
                }
                finally
                {
                    i++;
                }
            }))
            {
                await loop.DoAsync(w => Task.FromResult(i++));
                try
                {
                    await loop.DoAsync(w => DivZero());
                }
                catch
                {
                }
            }

            Assert.AreEqual(5, i);
        });