Пример #1
0
        public void Diff_is_not_same()
        {
            byte[] bytesA = new byte[32];
            new Random(42).NextBytes(bytesA);
            byte[]  bytesB = new byte[32];
            Bytes32 a      = new Bytes32(bytesA);
            Bytes32 b      = new Bytes32(bytesB);

            Assert.AreNotEqual(a, b);
            Assert.False(a.Equals(b));
            Assert.False(b.Equals(a));
            Assert.False(a == b);
            Assert.False(!(a != b));
            Assert.False(a.Equals((object)b));
            Assert.False(a.Equals(b));
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
            Assert.AreNotEqual(a.ToString(), b.ToString());
        }
Пример #2
0
        public void Same_is_same()
        {
            byte[] bytesA = new byte[32];
            new Random(42).NextBytes(bytesA);
            byte[] bytesB = new byte[32];
            bytesA.AsSpan().CopyTo(bytesB);
            Bytes32 a = new Bytes32(bytesA);
            Bytes32 b = new Bytes32(bytesB);

            Assert.AreEqual(a, b);
            Assert.True(a.Equals(b));
            Assert.True(b.Equals(a));
            Assert.True(a == b);
            Assert.True(!(a != b));
            Assert.True(a.Equals((object)b));
            Assert.True(a.Equals(b));
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
            Assert.AreEqual(a.ToString(), b.ToString());
        }