Esempio n. 1
0
        public void InequalityTest()
        {
            Criterion criterion1 = new Criterion("this is a random text");
            Criterion criterion2 = new Criterion("this also");

            Assert.IsTrue(criterion1 != criterion2);
            Assert.IsFalse(criterion1.Equals((object)criterion2));
            Assert.IsFalse(criterion1.Equals(criterion2));
        }
Esempio n. 2
0
        public void SutDoesNotEqualAnyObject(object other)
        {
            var sut = new Criterion <PlatformID>(
                PlatformID.Unix,
                new DelegatingEqualityComparer <PlatformID>());
            var actual = sut.Equals(other);

            Assert.False(actual, "SUT should not equal object of other type.");
        }
Esempio n. 3
0
        public void SutDoesNotEqualAnyObject(object other)
        {
            var sut = new Criterion <ConsoleColor>(
                ConsoleColor.Cyan,
                new DelegatingEqualityComparer <ConsoleColor>());
            var actual = sut.Equals(other);

            Assert.False(actual, "SUT should not equal object of other type.");
        }
Esempio n. 4
0
        public void SutEqualsIdenticalValue()
        {
            var target = Guid.NewGuid();
            var comparer = new DelegatingEqualityComparer<Guid>();
            var sut = new Criterion<Guid>(target, comparer);

            var other = new Criterion<Guid>(target, comparer);
            var actual = sut.Equals(other);

            Assert.True(actual, "Expected structural equality to hold.");
        }
Esempio n. 5
0
        public void SutEqualsIdenticalValue()
        {
            var target   = Guid.NewGuid();
            var comparer = new DelegatingEqualityComparer <Guid>();
            var sut      = new Criterion <Guid>(target, comparer);

            var other  = new Criterion <Guid>(target, comparer);
            var actual = sut.Equals(other);

            Assert.True(actual, "Expected structural equality to hold.");
        }
Esempio n. 6
0
        public void SutDoesNotEqualOtherWhenTargetDiffers(
            int sutTarget,
            int otherTarget)
        {
            var comparer = new DelegatingEqualityComparer <int>();
            var sut      = new Criterion <int>(sutTarget, comparer);

            var other  = new Criterion <int>(otherTarget, comparer);
            var actual = sut.Equals(other);

            Assert.False(
                actual,
                "SUT shouldn't equal other with different target");
        }
Esempio n. 7
0
        public void SutDoesNotEqualOtherWhenComparerDiffers(string target)
        {
            var sut = new Criterion <string>(
                target,
                new DelegatingEqualityComparer <string>());

            var other = new Criterion <string>(
                target,
                new DelegatingEqualityComparer <string>());
            var actual = sut.Equals(other);

            Assert.False(
                actual,
                "SUT shouldn't equal other with different comparer.");
        }
Esempio n. 8
0
        public void EqualsReturnsComparerResult(
            string target,
            string candidate,
            bool expected)
        {
            var comparer = new DelegatingEqualityComparer<string>
            {
                OnEquals = (x, y) =>
                {
                    Assert.Equal(target, x);
                    Assert.Equal(candidate, y);
                    return expected;
                }
            };
            var sut = new Criterion<string>(target, comparer);

            var actual = sut.Equals(candidate);

            Assert.Equal(expected, actual);
        }
Esempio n. 9
0
        public void EqualsReturnsComparerResult(
            string target,
            string candidate,
            bool expected)
        {
            var comparer = new DelegatingEqualityComparer <string>
            {
                OnEquals = (x, y) =>
                {
                    Assert.Equal(target, x);
                    Assert.Equal(candidate, y);
                    return(expected);
                }
            };
            var sut = new Criterion <string>(target, comparer);

            var actual = sut.Equals(candidate);

            Assert.Equal(expected, actual);
        }
Esempio n. 10
0
 public void SutDoesNotEqualAnyObject(object other)
 {
     var sut = new Criterion<PlatformID>(
         PlatformID.Unix,
         new DelegatingEqualityComparer<PlatformID>());
     var actual = sut.Equals(other);
     Assert.False(actual, "SUT should not equal object of other type.");
 }
Esempio n. 11
0
        public void SutDoesNotEqualOtherWhenComparerDiffers(string target)
        {
            var sut = new Criterion<string>(
                target,
                new DelegatingEqualityComparer<string>());

            var other = new Criterion<string>(
                target,
                new DelegatingEqualityComparer<string>());
            var actual = sut.Equals(other);

            Assert.False(
                actual,
                "SUT shouldn't equal other with different comparer.");
        }
Esempio n. 12
0
        public void SutDoesNotEqualOtherWhenTargetDiffers(
            int sutTarget,
            int otherTarget)
        {
            var comparer = new DelegatingEqualityComparer<int>();
            var sut = new Criterion<int>(sutTarget, comparer);

            var other = new Criterion<int>(otherTarget, comparer);
            var actual = sut.Equals(other);

            Assert.False(
                actual,
                "SUT shouldn't equal other with different target");
        }