Exemplo n.º 1
0
        public async Task Connect_IsPending()
        {
            var swarm = new SwarmService {
                LocalPeer = _self
            };
            var venus = new Peer
            {
                Id        = "QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
                Addresses = new MultiAddress[]
                {
                    "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", // mars.i.ipfs.io
                }
            };

            await swarm.StartAsync();

            try
            {
                Assert.IsFalse(swarm.HasPendingConnection(venus));

                var _ = swarm.ConnectAsync(venus);
                Assert.IsTrue(swarm.HasPendingConnection(venus));
            }
            finally
            {
                await swarm.StopAsync();
            }
        }