예제 #1
0
        public void IsMatchForTypeReturnsPredicateResult(bool isMatch)
        {
            var value    = Guid.NewGuid().ToString();
            var priority = Environment.TickCount;

            var sut = new TypePredicateCreationRule(item => isMatch, () => value, priority);

            var actual = sut.IsMatch(typeof(string));

            actual.Should().Be(isMatch);
        }
예제 #2
0
        public void IsMatchForPropertyReturnsFalse()
        {
            var propertyInfo = typeof(Person).GetProperty(nameof(Person.FirstName)) !;
            var value        = Guid.NewGuid().ToString();
            var priority     = Environment.TickCount;

            var sut = new TypePredicateCreationRule(item => true, () => value, priority);

            var actual = sut.IsMatch(propertyInfo);

            actual.Should().BeFalse();
        }
예제 #3
0
        public void IsMatchForParameterReturnsFalse()
        {
            var parameterInfo = typeof(Person).GetConstructors()
                                .First(x => x.GetParameters().FirstOrDefault()?.Name == "firstName").GetParameters().First();
            var value    = Guid.NewGuid().ToString();
            var priority = Environment.TickCount;

            var sut = new TypePredicateCreationRule(item => true, () => value, priority);

            var actual = sut.IsMatch(parameterInfo);

            actual.Should().BeFalse();
        }