コード例 #1
0
        public void Enrich(HtmlConventionsPreviewContext context, HtmlConventionsPreviewViewModel model)
        {
            var links = new List <PropertyLink>();

            context
            .NonConvertibleProperties()
            .Each(prop =>
            {
                var path = "{0}-{1}".ToFormat(context.Path, prop.Name);
                var type = prop.PropertyType;
                if (type.IsInterface || type.IsAbstract || type.IsGenericType ||
                    type.GetConstructor(new Type[0]) == null)
                {
                    path = "";
                }


                links.Add(new PropertyLink
                {
                    Path   = path,
                    Source = _sourceGenerator.SourceFor(prop)
                });
            });

            model.Links = links;
        }
コード例 #2
0
        public void Enrich(HtmlConventionsPreviewContext context, HtmlConventionsPreviewViewModel model)
        {
            var links = new List<PropertyLink>();
            context
                .NonConvertibleProperties()
                .Each(prop =>
                {
                    var path = "{0}-{1}".ToFormat(context.Path, prop.Name);
                    var type = prop.PropertyType;
                    if (type.IsInterface || type.IsAbstract || type.IsGenericType
                        || type.GetConstructor(new Type[0]) == null)
                    {
                        path = "";
                    }

                    links.Add(new PropertyLink
                    {
                        Path = path,
                        Source = _sourceGenerator.SourceFor(prop)
                    });
                });

            model.Links = links;
        }
コード例 #3
0
 public void should_select_properties_whose_types_cannot_be_converted_to_strings()
 {
     _context
     .NonConvertibleProperties()
     .ShouldHaveCount(2);
 }