Example #1
0
        public void Want_Unwant()
        {
            var bitswap = new Bitswap {
                Swarm = new Swarm {
                    LocalPeer = self
                }
            };
            var cid    = new DagNode(Encoding.UTF8.GetBytes("BitswapTest unknown block")).Id;
            var cancel = new CancellationTokenSource();
            var task   = bitswap.Want(cid, self.Id, cancel.Token);

            CollectionAssert.Contains(bitswap.PeerWants(self.Id).ToArray(), cid);

            bitswap.Unwant(cid);
            Assert.IsTrue(task.IsCanceled);
            CollectionAssert.DoesNotContain(bitswap.PeerWants(self.Id).ToArray(), cid);
        }