public void GetHashCode_Success()
        {
            NetworkAddress a1 = new NetworkAddress(1);
            NetworkAddress a2 = new NetworkAddress(2);
            NetworkAddress a3 = new NetworkAddress(2);

            int a2Hash = a2.GetHashCode();
            int a3Hash = a2.GetHashCode();

            Assert.IsFalse(a1.GetHashCode() == a2.GetHashCode());
            Assert.AreEqual(a2Hash, a3Hash);
        }
Example #2
0
 /// <summary>
 ///   TODO: Update Comments
 ///
 /// </summary>
 /// <returns>
 ///     A int value...
 /// </returns>
 public override int GetHashCode()
 {
     unchecked
     {
         return((NetworkAddress.GetHashCode() * 397) ^ SerialNumber.GetHashCode());
     }
 }
Example #3
0
        public override int GetHashCode()
        {
            int prime  = 31;
            int result = 1;

            result = prime * result + /*((depth == null) ? 0 :*/ Depth.GetHashCode();
            result = prime * result + /*((DeviceType == null) ? 0 :*/ DeviceType.GetHashCode();
            result = prime * result + /*((ExtendedAddress == null) ? 0 :*/ ExtendedAddress.GetHashCode();
            result = prime * result + ((ExtendedPanId == null) ? 0 : ExtendedPanId.GetHashCode());
            result = prime * result + /*((lqi == null) ? 0 : */ Lqi.GetHashCode();
            result = prime * result + /*((networkAddress == null) ? 0 :*/ NetworkAddress.GetHashCode();
            result = prime * result + /*((PermitJoining == null) ? 0 :*/ PermitJoining.GetHashCode();
            result = prime * result + /*((Relationship == null) ? 0 :*/ Relationship.GetHashCode();
            result = prime * result + /*((RxOnWhenIdle == null) ? 0 :*/ RxOnWhenIdle.GetHashCode();
            return(result);
        }
Example #4
0
        public void GetHashCodeTest()
        {
            var addr1 = new NetworkAddress(NodeServiceFlags.NodeNone, IPAddress.Parse("1.2.3.4"), 111);
            var addr2 = new NetworkAddress(NodeServiceFlags.NodeNone, IPAddress.Parse("1.2.3.4"), 111);
            var addr3 = new NetworkAddress(NodeServiceFlags.NodeNetwork, IPAddress.Parse("1.2.3.4"), 111);
            var addr4 = new NetworkAddress(NodeServiceFlags.NodeNone, IPAddress.Parse("1.2.3.5"), 111);
            var addr5 = new NetworkAddress(NodeServiceFlags.NodeNone, IPAddress.Parse("1.2.3.4"), 112);

            int h1 = addr1.GetHashCode();
            int h2 = addr2.GetHashCode();
            int h3 = addr3.GetHashCode();
            int h4 = addr4.GetHashCode();
            int h5 = addr5.GetHashCode();

            Assert.Equal(h1, h2);
            Assert.Equal(h1, h3);
            Assert.NotEqual(h1, h4);
            Assert.NotEqual(h1, h5);
            Assert.NotEqual(h4, h5);
        }
Example #5
0
 public override int GetHashCode()
 {
     return(NetworkAddress == null ? 0 : NetworkAddress.GetHashCode());
 }
 public override int GetHashCode()
 {
     unchecked {
         return((NetworkAddress.GetHashCode() * 397) ^ (int)ControlPlaneElement);
     }
 }