コード例 #1
0
        public void GetHashCode_returns_different_values_with_different_value()
        {
            // arrange
            TagCompound target;
            int         actual;
            int         notExpected;

            target = new TagCompound(string.Empty, new TagDictionary {
                new TagByte("A", 2), new TagShort("B", 4), new TagInt("C", 8)
            });

            notExpected = new TagCompound(string.Empty, new TagDictionary {
                new TagByte("A", 2), new TagShort("B", 4), new TagInt("C", 16)
            }).GetHashCode();

            // act
            actual = target.GetHashCode();

            // assert
            Assert.NotEqual(notExpected, actual);
        }
コード例 #2
0
        public void GetHashCode_returns_same_value_for_matching_tags()
        {
            // arrange
            TagCompound target;
            int         actual;
            int         expected;

            target = new TagCompound("beta", new TagDictionary {
                new TagByte("A", 2), new TagShort("B", 4), new TagInt("C", 8)
            });

            expected = new TagCompound("beta", new TagDictionary {
                new TagByte("A", 2), new TagShort("B", 4), new TagInt("C", 8)
            }).GetHashCode();

            // act
            actual = target.GetHashCode();

            // assert
            Assert.Equal(expected, actual);
        }