Пример #1
0
        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
        }
Пример #2
0
        public void FieldSpecificationIsCorrect()
        {
            // Fixture setup
            var dummyComparer      = new DelegatingEqualityComparer();
            var expected           = new DelegatingSpecification <FieldInfo>();
            var dummySpecification = new DelegatingSpecification <PropertyInfo>();

            var sut = new MemberComparer(
                dummyComparer,
                dummySpecification,
                expected);
            // Exercise system
            var result = sut.FieldSpecification;

            // Verify outcome
            Assert.Equal(expected, result);
            // Teardown
        }
Пример #3
0
        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
        }