示例#1
0
        public void IsIgnoredReturnsTrueWhenParameterMatchesStringPropertyWithNameMatch()
        {
            var configuration = Model.UsingDefaultConfiguration();
            var value         = Guid.NewGuid().ToString();
            var model         = new ClassMatchingNameWrapper <string>(value);
            var propertyInfo  =
                typeof(ClassMatchingNameWrapper <string>).GetProperty(nameof(ClassMatchingNameWrapper <string> .Value)) !;
            var args = new object?[]
            {
                value
            };

            var sut = new DefaultPropertyResolver(CacheLevel.PerInstance);

            var actual = sut.IsIgnored(configuration, model, propertyInfo, args);

            actual.Should().BeTrue();
        }
示例#2
0
        public void IsIgnoredReturnsFalseWhenParameterDoesNotMatchReferencePropertyWithNameMatch()
        {
            var configuration = Model.UsingDefaultConfiguration();
            var value         = new Person();
            var model         = new ClassMatchingNameWrapper <Person>(value);
            var propertyInfo  =
                typeof(ClassMatchingNameWrapper <Person>).GetProperty(nameof(ClassMatchingNameWrapper <Person> .Value)) !;
            var args = new object?[]
            {
                new Person()
            };

            var sut = new DefaultPropertyResolver(CacheLevel.PerInstance);

            var actual = sut.IsIgnored(configuration, model, propertyInfo, args);

            actual.Should().BeFalse();
        }