Exemplo n.º 1
0
        public void GetPeersByHost_ShouldReturnAllPeers_WithSameHost()
        {
            IPAddress commonHost     = IPAddress.Parse("12.34.56.67");
            string    commonPort     = "1900";
            string    commonEndpoint = commonHost + ":" + commonPort;

            _peerPool.TryAddPeer(CreatePeer(commonEndpoint));
            _peerPool.TryAddPeer(CreatePeer(commonEndpoint));
            _peerPool.TryAddPeer(CreatePeer("12.34.56.64:1900"));
            _peerPool.TryAddPeer(CreatePeer("12.34.56.61:1900"));

            var peersWithSameHost = _peerPool.GetPeersByIpAddress(commonHost);

            peersWithSameHost.Count.ShouldBe(2);
        }