コード例 #1
0
        public void IsIgnoredReturnsTrueWhenParameterMatchesReferencePropertyWithNameMismatch()
        {
            var configuration = Model.UsingDefaultConfiguration();
            var item          = new Person();
            var model         = new ClassMismatchingNameWrapper <Person>(item);
            var propertyInfo  =
                typeof(ClassMismatchingNameWrapper <Person>).GetProperty(
                    nameof(ClassMismatchingNameWrapper <Person> .Value)) !;
            var args = new object?[]
            {
                item
            };

            var sut = new DefaultPropertyResolver(CacheLevel.PerInstance);

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

            actual.Should().BeTrue();
        }
コード例 #2
0
        public void IsIgnoredReturnsFalseWhenParameterDoesNotMatchStringPropertyWithNameMismatch()
        {
            var configuration = Model.UsingDefaultConfiguration();
            var item          = Guid.NewGuid().ToString();
            var model         = new ClassMismatchingNameWrapper <string>(item);
            var propertyInfo  =
                typeof(ClassMismatchingNameWrapper <string>).GetProperty(
                    nameof(ClassMismatchingNameWrapper <string> .Value)) !;
            var args = new object?[]
            {
                Guid.NewGuid().ToString()
            };

            var sut = new DefaultPropertyResolver(CacheLevel.PerInstance);

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

            actual.Should().BeFalse();
        }