Beispiel #1
0
        public void Test_Plottable_Methods_HaveXmlDocumentation()
        {
            foreach (Type plottableType in PlottableTypes)
            {
                foreach (var mi in Locate.GetNotablePlottableMethods(plottableType))
                {
                    // TODO: figure out how to do XML name lookups for inherited generics!

                    if (mi.DeclaringType.FullName != null &&
                        mi.DeclaringType.FullName.Contains("SignalPlot"))
                    {
                        continue;
                    }

                    if (mi.ReflectedType.FullName != null &&
                        mi.ReflectedType.FullName.Contains("SignalPlot"))
                    {
                        continue;
                    }

                    XElement xml = GetXmlFor(mi);
                    AssertDocumentedSummary(mi, xml);
                }
            }
        }
Beispiel #2
0
        public void AddPlottableDetails(XmlDoc xd, Type plottableType)
        {
            string typeName = Locate.TypeName(plottableType);
            string typeUrl = Locate.TypeName(plottableType, urlSafe: true);

            AddHTML($"<div><strong>This page describes <code>ScottPlot.Plottable.{typeName}</code></strong></div>");

            string classSummary = xd.GetSummary(plottableType);
            AddHTML($"<div><strong>Summary:</strong> {classSummary}</div>");

            AddHTML($"<blockquote>" +
                "⚠️ <strong>Only public methods are shown below.</strong> " +
                "This plot type likely has properties and fields to customize its behavior and styling, " +
                "but they do not appear on this page. " +
                "</blockquote>");

            // TODO: fix URLs for generic types
            string apimundoUrl =
                "https://apimundo.com/organizations/nuget-org/nuget-feeds/public/packages/ScottPlot/versions/latest?" +
                "tab=types&namespace=ScottPlot.Plottable&type=ScottPlot.Plottable." + typeName;
            AddHTML($"<div>💡 Read more on Apimundo: <a href='{apimundoUrl}'>ScottPlot.Plottable.{typeName}</a></div>");

            foreach (MethodInfo mi in Locate.GetNotablePlottableMethods(plottableType))
            {
                string methodSummary = xd.GetSummary(mi);
                string returnType = XmlDoc.PrettyType(mi.ReturnType);
                string signature = XmlDoc.PrettySignature(mi);

                AddGroupHeader(mi.Name + "()");
                AddHTML($"<div><strong>Summary:</strong> {methodSummary}</div>");

                AddHTML($"<div><strong>Parameters:</strong></div>");
                AddHTML("<ul>");
                foreach (var p in mi.GetParameters())
                    AddHTML($"<li><code>{XmlDoc.PrettyType(p.ParameterType)}</code> {p.Name}</li>");
                AddHTML("</ul>");

                AddHTML($"<div><strong>Returns:</strong></div>");
                AddHTML($"<ul><li><code>{returnType}</code></li></ul>");

                AddHTML($"<div><strong>Signature:</strong></div>");
                AddHTML($"<ul><li><code>{signature}</code></li></ul>");
            }
        }