public async Task TestAliceReturnConflict()
        {
            var enumerator = new CreateChannelEnumerable(packetService, Task.FromResult <Channel>(null), bobId, bobChannelId, tempChannelId).GetAsyncEnumerator();

            Assert.IsTrue(await enumerator.MoveNextAsync());
            var response = enumerator.Current as P2FCreateChannelResponse;

            Assert.IsNotNull(response, "The returned packet is not of type " + nameof(P2FCreateChannelResponse));
            Assert.AreEqual(tempChannelId, response.TempChannelId);
            Assert.AreEqual(CreateChannelStatus.AlreadyExists, response.StatusCode);
            Assert.IsFalse(await enumerator.MoveNextAsync());
        }
        public async Task TestAliceBroadcastSuccess()
        {
            var channel = new Channel {
                ChannelType = ChannelType.Direct, OwnerId = aliceId
            };
            var enumerator = new CreateChannelEnumerable(packetService, Task.FromResult(channel), bobId, bobChannelId).GetAsyncEnumerator();

            Assert.IsTrue(await enumerator.MoveNextAsync());
            var adc = enumerator.Current as P0ACreateChannel;

            Assert.IsNotNull(adc, "The returned packet is not of type " + nameof(P0ACreateChannel));
            Assert.AreEqual(bobChannelId, adc.ChannelId);
            Assert.AreEqual(ChannelType.AccountData, adc.ChannelType);
            Assert.IsTrue(await enumerator.MoveNextAsync());
            var response = enumerator.Current as P0ACreateChannel;

            Assert.IsNotNull(response, "The returned packet is not of type " + nameof(P0ACreateChannel));
            Assert.AreEqual(ChannelType.Direct, response.ChannelType);
            Assert.AreEqual(bobId, response.CounterpartId);
            Assert.IsFalse(await enumerator.MoveNextAsync());
        }
        public async Task TestWaitForChannelCreation()
        {
            var tcs               = new TaskCompletionSource <Channel>();
            var enumerator        = new CreateChannelEnumerable(packetService, tcs.Task, bobId, bobChannelId).GetAsyncEnumerator();
            ValueTask <bool> task = enumerator.MoveNextAsync();
            await Task.Delay(10).ConfigureAwait(false);

            Assert.IsFalse(task.IsCompleted);
            tcs.SetResult(new Channel());
            Assert.IsTrue(await task);
            Assert.IsNotNull(enumerator.Current);
        }
        public async Task TestBobBroadcastConflict()
        {
            var enumerator = new CreateChannelEnumerable(packetService, Task.FromResult <Channel>(null), aliceId, aliceChannelId).GetAsyncEnumerator();

            Assert.IsFalse(await enumerator.MoveNextAsync());
        }