示例#1
0
        public void compare_two_string_by_length_using_get_hash_code()
        {
            const string string1  = "lorem";
            const string string2  = "ipsum";
            var          comparer = new PropertyComparer <string>(x => x.Length);

            Assert.Equal(comparer.GetHashCode(string1), comparer.GetHashCode(string2));
        }
        public void compare_two_string_by_length_using_get_hash_code()
        {
            const string string1 = "lorem";
            const string string2 = "ipsum";
            var comparer = new PropertyComparer<string>(x => x.Length);

            Assert.Equal(comparer.GetHashCode(string1), comparer.GetHashCode(string2));
        }
示例#3
0
        public void TestHashCode()
        {
            var entity1 = new Comparable {
                Id = 1, Name = "Name", Description = "Description"
            };
            var entity2 = new Comparable {
                Id = 1, Name = "Name", Description = "Description"
            };
            var comparer = new PropertyComparer <Comparable>();

            Assert.Equal(comparer.GetHashCode(entity1), comparer.GetHashCode(entity2));
        }