public void LoadPage_ShouldLoadXmlWebPageData()
        {
            //Act
            var actual = WebPageHelper.LoadPage("https://www.w3schools.com/xml/plant_catalog.xml");

            //Assert
            Assert.NotNull(actual);
        }
        public void LoadPage_ShouldLoadHtmlWebPageData()
        {
            //Act
            var actual = WebPageHelper.LoadPage("http://www.facebook.com");

            //Assert
            Assert.NotNull(actual);
        }
Ejemplo n.º 3
0
        private static void CreateAppPage(SPWeb web, string pageName, string masterUrl, bool overWrite)
        {
            string notifyPageUrl = string.Concat(web.Url, string.Format(CultureInfo.InvariantCulture, "/{0}.aspx", pageName));
            SPFile pageFile      = web.GetFile(notifyPageUrl);

            if (pageFile.Exists)
            {
                pageFile.Delete();
            }

            WebPageHelper.CreateAppWebPage(web, string.Format(CultureInfo.InvariantCulture, "{0}.aspx", pageName), masterUrl, overWrite);
        }
    public static string GetMainTopAdvPic(HttpServerUtility server, int m_PostId1)
    {
        string content = string.Empty;

        WebPageHelper webPageHelper = new WebPageHelper();
        PostFactory postFactory = new PostFactory();
        IPostService postService = postFactory.GetPostService();

        PostVO podeVO = postService.GetPostById(m_PostId1);
        if (podeVO != null)
        {
            string advFile = server.MapPath("~/template/") + "main-adv-pic01.txt";
            string fileContent = File.ReadAllText(advFile, System.Text.Encoding.UTF8);

            content = fileContent.Replace("(#FILENAME)", webPageHelper.GetContent(podeVO, "PicFileName"));
        }

        return content;
    }
    public static string GetMainTopAdvPic(HttpServerUtility server, int m_PostId1)
    {
        string content = string.Empty;

        WebPageHelper webPageHelper = new WebPageHelper();
        PostFactory   postFactory   = new PostFactory();
        IPostService  postService   = postFactory.GetPostService();

        PostVO podeVO = postService.GetPostById(m_PostId1);

        if (podeVO != null)
        {
            string advFile     = server.MapPath("~/template/") + "main-adv-pic01.txt";
            string fileContent = File.ReadAllText(advFile, System.Text.Encoding.UTF8);

            content = fileContent.Replace("(#FILENAME)", webPageHelper.GetContent(podeVO, "PicFileName"));
        }

        return(content);
    }
Ejemplo n.º 6
0
        public IEnumerable <IGrouping <string, HtmlNode> > GetTags(string url)
        {
            content = WebPageHelper.LoadPage(url);

            tags = content.DocumentNode.Descendants().ToList();

            var groupedTags = tags
                              .Where(x => x.NodeType == HtmlNodeType.Element)
                              .GroupBy(x => x.Name);

            if (groupedTags.Count() > 0)
            {
                Console.WriteLine(" Unique tags found:");

                foreach (var tag in groupedTags)
                {
                    Console.WriteLine($" Name: {tag.Key} with {tag.Count()} occurrences.");
                }

                Console.WriteLine("  ");
            }

            return(groupedTags);
        }
Ejemplo n.º 7
0
 public static void CreateBlankPage(SPWeb web, string pageName)
 {
     WebPageHelper.CreateBlankWebPage(web, string.Format(CultureInfo.InvariantCulture, "{0}.aspx", pageName), false);
 }
Ejemplo n.º 8
0
 public static void CreateNewDetailPage(SPWeb web, string pageName)
 {
     WebPageHelper.CreateNewDetailWebPage(web, string.Format(CultureInfo.InvariantCulture, "{0}.aspx", pageName), true);
 }
Ejemplo n.º 9
0
 private static void CreateDetailPage(SPWeb web, string pageName)
 {
     WebPageHelper.CreateDetailWebPage(web, string.Format(CultureInfo.InvariantCulture, "{0}.aspx", pageName), false);
 }