public void IPv4Address_Equals() { Random random = new Random(); Byte[] firstAddressBytes = random.NextBytes(4); Byte[] secondAddressBytes = new Byte[4]; firstAddressBytes.CopyTo(secondAddressBytes, 0); IPv4Address firstAddress = IPv4Address.FromByteArray(firstAddressBytes); IPv4Address secondAddress = IPv4Address.FromByteArray(secondAddressBytes); Boolean result = firstAddress.Equals(secondAddress); Assert.True(result); Assert.Equal(firstAddress, secondAddress); Byte[] thirdAddressBytes = random.NextBytes(4); IPv4Address thirdAddress = IPv4Address.FromByteArray(thirdAddressBytes); Boolean nonEqualResult = firstAddress.Equals(thirdAddress); Assert.False(nonEqualResult); Assert.NotEqual(firstAddress, thirdAddress); Assert.True(firstAddress == secondAddress); Assert.False(firstAddress != secondAddress); Assert.False(firstAddress == thirdAddress); Assert.True(firstAddress != thirdAddress); }