public void Can_sort_by_trusted() { Node a = new Node(TestItem.PublicKeyA, "127.0.0.1", 30303); a.IsTrusted = true; Peer peerA = new Peer(a); Node b = new Node(TestItem.PublicKeyB, "127.0.0.1", 30303); Peer peerB = new Peer(b); Node c = new Node(TestItem.PublicKeyC, "127.0.0.1", 30303); Peer peerC = new Peer(c); Assert.AreEqual(-1, _comparer.Compare(peerA, peerB)); Assert.AreEqual(0, _comparer.Compare(peerB, peerC)); }
public void Can_sort_by_Reputation() { Node a = new Node(TestItem.PublicKeyA, "127.0.0.1", 30303); Peer peerA = new Peer(a); Node b = new Node(TestItem.PublicKeyB, "127.0.0.1", 30303); Peer peerB = new Peer(b); Node c = new Node(TestItem.PublicKeyC, "127.0.0.1", 30303); Peer peerC = new Peer(c); _statsManager.GetCurrentReputation(a).Returns(100); _statsManager.GetCurrentReputation(b).Returns(50); _statsManager.GetCurrentReputation(c).Returns(200); Assert.AreEqual(-1, _comparer.Compare(peerA, peerB)); Assert.AreEqual(1, _comparer.Compare(peerA, peerC)); Assert.AreEqual(1, _comparer.Compare(peerB, peerC)); Assert.AreEqual(0, _comparer.Compare(peerA, peerA)); Assert.AreEqual(0, _comparer.Compare(peerB, peerB)); Assert.AreEqual(0, _comparer.Compare(peerC, peerC)); }