Ejemplo n.º 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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }