예제 #1
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        public override int GetHashCode()
        {
            int hashCode = FactoryType.GetHashCode();

            hashCode ^= (PrimaryContract != null ? 397 * PrimaryContract.GetHashCode() : 0);
            hashCode ^= ExtensionValue1 ^ (SecondaryContract1 != null ? 397 * SecondaryContract1.GetHashCode() : 0);
            hashCode ^= ExtensionValue2 ^ (SecondaryContract2 != null ? 397 * SecondaryContract2.GetHashCode() : 0);
            hashCode ^= ExtensionValue3 ^ (SecondaryContract3 != null ? 397 * SecondaryContract3.GetHashCode() : 0);

            return(hashCode);
        }
예제 #2
0
        public void GetHashCode_EqualClrBindings_MustBeEqual()
        {
            //-- arrange

            var typeMember1 = new TypeMember(typeof(IFormatProvider));
            var typeMember2 = new TypeMember(typeof(IFormatProvider));

            //-- act

            var hash1 = typeMember1.GetHashCode();
            var hash2 = typeMember2.GetHashCode();

            //-- assert

            hash2.Should().Be(hash1);
        }