/// <summary>
        /// Deserializes a list of articles from json
        /// </summary>
        /// <param name="json"></param>
        /// <returns></returns>
        private IList <Article> DeserializeArticlesFromJson(string json)
        {
            IList <Article> articles = new List <Article>();

            try
            {
                articles = JsonConvert.DeserializeObject <List <Article> >(json);

                foreach (var article in articles)
                {
                    //Strip teasers to remove unwanted html tags
                    ArticleStripper.StripArticleTeasers(article);
                    try
                    {
                        DateTime publishedDateTime = DateTime.ParseExact(article.publishedDate, "dd-MM-yyyy HH:mm", CultureInfo.InvariantCulture);
                        article.publishedDateTime = publishedDateTime;
                    }
                    catch (Exception e) { Debug.Print(e.Message); }
                }

                //The first article in the list is a top article
                if (articles.Count > 0)
                {
                    articles[0].isTopArticle = true;
                }

                return(articles);
            }
            catch (Exception e)
            {
                Debug.Print("Could not deserialize articles: " + e.Message);
                return(articles);
            }
        }
        public void StripAllHtmlParagraphTagsShouldStripAllHtmlParagraphs()
        {
            //Arrange
            string str = "<p>This</p> string contains <p>some</p> html <p>paragraph tags</p>";

            //Act
            string res = ArticleStripper.StripAllHtmlParagraphTags(str);

            //Assert
            Assert.True(res.Equals("This string contains some html paragraph tags"));
        }
        public void StripAllHtmlParagraphTagsShouldNotThrowExceptionWhenInputIsNull()
        {
            //Arrange
            string str = null;

            //Act
            ArticleStripper.StripAllHtmlParagraphTags(str);

            //Assert
            //no exception should be thrown
        }
        public void StripArticleBodyTextShouldNotThrowExceptionWhenBodyTextIsNull()
        {
            //Arrange
            Article article = new Article();

            //Act
            ArticleStripper.StripArticleBodyText(article);

            //Assert
            //no exception should be thrown
        }
        public void StripArticleTeasersShouldNotThrowExceptionWhenTeasersIsNull()
        {
            //Arrange
            Article article = new Article();

            //Act
            ArticleStripper.StripArticleTeasers(article);

            //Assert
            //no exception should be thrown
        }
        public void StripRelatedArticlesShouldStripRelatedArticles()
        {
            //Arrange
            string str = "This<ul>string contains</ul> unordered list html<ul>tags</ul>";

            //Act
            string res = ArticleStripper.StripRelatedArticles(str);

            //Assert
            Assert.True(res.Equals("This unordered list html"));
        }
        public void StripRelatedArticlesShouldNotThrowExceptionWhenInputIsNull()
        {
            //Arrange
            string str = null;

            //Act
            ArticleStripper.StripRelatedArticles(str);

            //Assert
            //no exception should be thrown
        }
        /// <summary>
        /// Prepares the an article so it looks good in the app.
        /// </summary>
        /// <param name="article"></param>
        /// <returns></returns>
        public Article PrepareArticle(Article article)
        {
            article = ArticleStripper.StripArticleBodyText(article);
            article = ArticleStripper.StripArticleTeasers(article);

            if (article.topImages?.Count > 0)
            {
                article.topImage = article.topImages[0];
            }

            return(article);
        }
        public void StripArticleBodyTextShouldStripTheArticlesBodyText()
        {
            //Arrange
            Article article = new Article()
            {
                bodyText = "This<ul>string contains</ul> unordered list html<ul>tags</ul>"
            };

            //Act
            ArticleStripper.StripArticleBodyText(article);

            //Assert
            Assert.True(article.bodyText.Equals("This unordered list html"));
        }
        public void StripArticleTeasersShouldStripTheArticlesTeasers()
        {
            //Arrange
            Article article = new Article();
            Teasers teaser  = new Teasers()
            {
                FRONTPAGE = "front<p>Page</p>Teaser", DEFAULT = "default<p>Teaser</p>"
            };

            article.teasers = teaser;

            //Act
            ArticleStripper.StripArticleTeasers(article);

            //Assert
            Assert.True(article.teasers.FRONTPAGE.Equals("frontPageTeaser"));
            Assert.True(article.teasers.DEFAULT.Equals("defaultTeaser"));
        }