public void InitializeWithNullFieldSpecificationThrows()
 {
     // Fixture setup
     var dummyComparer = new DelegatingEqualityComparer();
     var dummySpecification = new DelegatingSpecification<PropertyInfo>();
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         new MemberComparer(
             dummyComparer,
             dummySpecification,
             null));
     // Teardown
 }
        public void PropertySpecificationIsCorrect()
        {
            // Fixture setup
            var dummyComparer = new DelegatingEqualityComparer();
            var expected = new DelegatingSpecification<PropertyInfo>();
            var dummySpecification = new DelegatingSpecification<FieldInfo>();

            var sut = new MemberComparer(
                dummyComparer,
                expected,
                dummySpecification);
            // Exercise system
            var result = sut.PropertySpecification;
            // Verify outcome
            Assert.Equal(expected, result);
            // Teardown
        }
        public void IsSatisfiedByForFieldReturnsCorrectResult(bool expected)
        {
            // Fixture setup
            var field = typeof(FieldHolder<int>).GetField("Field");
            var dummyComparer = new DelegatingEqualityComparer();
            var dummySpecification = new DelegatingSpecification<PropertyInfo>();

            var fieldSpecificationStub =
                new DelegatingSpecification<FieldInfo>
                {
                    OnIsSatisfiedBy = x => expected
                };

            var sut = new MemberComparer(
                dummyComparer,
                dummySpecification,
                fieldSpecificationStub);
            // Exercise system
            var result = sut.IsSatisfiedBy(field);
            // Verify outcome
            Assert.Equal(expected, result);
            // Teardown
        }