Beispiel #1
0
        public void ValueMatcherEqualsByTypeAndValue()
        {
            var matcher = new ValueMatcher(typeof(string), "foo");
            var other   = new ValueMatcher(typeof(string), "foo");

            Assert.True(matcher.Equals(other));
            Assert.Equal(matcher.GetHashCode(), other.GetHashCode());

            Assert.False(matcher.Equals(new ValueMatcher(typeof(string), "bar")));
            Assert.False(matcher.Equals(new ValueMatcher(typeof(object), "foo")));
        }
Beispiel #2
0
        public void ValueMatcherEqualsByEqualityComparer()
        {
            var comparer = StringComparer.OrdinalIgnoreCase;
            var matcher  = new ValueMatcher(typeof(string), "foo", comparer);
            var other    = new ValueMatcher(typeof(string), "FOO", comparer);

            Assert.True(matcher.Equals(other));
            Assert.Equal(matcher.GetHashCode(), other.GetHashCode());

            Assert.False(matcher.Equals(new ValueMatcher(typeof(string), "bar")));
            Assert.False(matcher.Equals(new ValueMatcher(typeof(object), "foo")));
        }