private static async Task AddToQueue(ChannelQueue <PersonProper> channel, IList <PersonProper> people, CancellationToken token)
        {
            foreach (var person in people)
            {
                await channel.WriteAsync(person, cancellationToken : token).ConfigureAwait(false);
            }

            _ = channel.Lock();
        }
        public async Task WriteAsyncTest02()
        {
            var channel = new ChannelQueue <PersonProper>();
            var person  = RandomData.GenerateRefPerson <PersonProper>();
            var token   = CancellationToken.None;

            _ = channel.Lock();

            try
            {
                await channel.WriteAsync(person, cancellationToken : token).ConfigureAwait(false);
            }
            catch (ChannelClosedException ex)
            {
                Trace.WriteLine(ex);

                Assert.IsTrue(true);
            }
            catch
            {
                Assert.Fail();
            }
        }
        public async Task WriteReadAsyncTest03()
        {
            var       channel = new ChannelQueue <PersonProper>();
            const int Count   = 5;

            var people = RandomData.GeneratePersonRefCollection <PersonProper>(Count);
            var token  = CancellationToken.None;

            foreach (var person in people)
            {
                await channel.WriteAsync(person, cancellationToken : token).ConfigureAwait(false);
            }

            Assert.IsTrue(channel.Count == Count);

            _ = channel.Lock();

            await foreach (var item in channel.ListenAsync(token))
            {
                Trace.WriteLine(item.Email);
            }

            Assert.IsTrue(channel.Count == 0);
        }