コード例 #1
0
        public void EqualsShouldMatchHashCode()
        {
            // arrange
            var target = new DynamicComparer<string>( s => s.GetHashCode() );

            // act
            var actual = target.Equals( "test", "test" );

            // assert
            Assert.True( actual );
        }
コード例 #2
0
        public void IEqualityComparerEqualsShouldReturnTrueWhenEqual()
        {
            // arrange
            IEqualityComparer target = new DynamicComparer<string>( ( s1, s2 ) => s1.CompareTo( s2 ) );

            // act
            var actual = target.Equals( "test", "test" );

            // assert
            Assert.True( actual );
        }
コード例 #3
0
        public void EqualsShouldMatchComparison()
        {
            // arrange
            var target = new DynamicComparer<string>( ( s1, s2 ) => s1.CompareTo( s2 ) );

            // act
            var actual = target.Equals( "test", "test" );

            // assert
            Assert.True( actual );
        }