Esempio n. 1
0
        public SharePointGroup()
        {
            AddApiCallHandler = async(keyValuePairs) =>
            {
                return(await Task.Run(() =>
                {
                    var endPointUri = $"_api/web/sitegroups";

                    var body = new
                    {
                        __metadata = new { type = "SP.Group" },
                        Title,
                    };
                    var jsonBody = JsonSerializer.Serialize(body);
                    return new ApiCall(endPointUri, ApiType.SPORest, jsonBody);
                }).ConfigureAwait(false));
            };

            ValidateUpdateHandler = (PropertyUpdateRequest propertyUpdateRequest) =>
            {
                if (propertyUpdateRequest.PropertyName == nameof(Description))
                {
                    propertyUpdateRequest.Value = HtmlToText.ConvertSimpleHtmlToText(propertyUpdateRequest.Value.ToString(), 511);
                }
            };
        }
Esempio n. 2
0
        public void SimpleText()
        {
            string input    = "this is not html";
            string expected = "this is not html";
            var    result   = HtmlToText.ConvertSimpleHtmlToText(input, 1000);

            Assert.AreEqual(expected, result);
        }
Esempio n. 3
0
        public void SpecialCharHtml()
        {
            string input    = "<meta name=\"analytics-location\" content=\"/&lt;user-name&gt;/&lt;repo-name&gt;\" data-pjax-transient=\"true\">This &quot; &quot; &amp; &#39; &lt; &gt; &#160; is text</meta>";
            string expected = "This \" \" & ' < >   is text";
            var    result   = HtmlToText.ConvertSimpleHtmlToText(input, 1000);

            Assert.AreEqual(expected, result);
        }
Esempio n. 4
0
        public void SimpleHtml()
        {
            string input    = "this <B>is</B> not <Span><Span>html</Span></span>";
            string expected = "this is not html";
            var    result   = HtmlToText.ConvertSimpleHtmlToText(input, 1000);

            Assert.AreEqual(expected, result);
        }
Esempio n. 5
0
        public void ComplexHtmlWithLengtLimit()
        {
            string input    = "<title>GitHub - pnp/pnpcore: The PnP Core SDK is a modern .NET SDK designed to work for Microsoft 365. It provides a unified object model for working with SharePoint Online and Teams which is agnostic to the underlying API&#39;s being called</title><meta name=\"description\" content=\"The PnP Core SDK is a modern .NET SDK designed to work for Microsoft 365. It provides a unified object model for working with SharePoint Online and Teams which is agnostic to the underlying API&#39;s being called - GitHub - pnp/pnpcore: The PnP Core SDK is a modern .NET SDK designed to work for Microsoft 365. It provides a unified object model for working with SharePoint Online and Teams which is agnostic to the underlying API&#39;s being called\"><link rel=\"search\" type=\"application/opensearchdescription+xml\" href=\"/opensearch.xml\" title=\"GitHub\"><link rel=\"fluid-icon\" href=\"https://github.com/fluidicon.png\" title=\"GitHub\">";
            string expected = "GitHub - pnp/pnpcore: The PnP Core SDK is a modern .NET SDK designed to work for Microsoft 365. It provides a unified object model for working with Sha";
            var    result   = HtmlToText.ConvertSimpleHtmlToText(input, 151);

            Assert.AreEqual(expected, result);
            Assert.IsTrue(expected.Length == 151);
        }