public void HackerNewsStoryItemValidator_ValidateAuthor_EmptyString_ReturnsFalse() { //Arrange var author = string.Empty; //Act var result = _validator.IsAuthorValid(author); //Assert Assert.IsFalse(result); }
/// <summary> /// Get items for a story. /// </summary> /// <param name="titleItem"></param> /// <param name="subtextItem"></param> /// <returns></returns> private HackerNewsStory GetStoryData(HtmlNode titleItem, HtmlNode subtextItem) { var title = _parser.GetTitle(titleItem); title = _validator.IsTitleValid(title) ? title : _settings.TitleDefault; var uri = _parser.GetUri(titleItem); uri = _validator.IsUriValid(uri) ? uri : _settings.UriDefault; var author = _parser.GetAuthor(subtextItem); author = _validator.IsAuthorValid(author) ? author : _settings.AuthorDefault; var comments = _parser.GetNumberOfComments(subtextItem); comments = _validator.IsCommentsValid(comments) ? comments : _settings.CommentsDefault; var points = _parser.GetNumberOfPoints(subtextItem); points = _validator.IsPointsValid(points) ? points : _settings.PointsDefault; var rank = _parser.GetRank(titleItem); rank = _validator.IsRankValid(rank) ? rank : _settings.RankDefault; return(new HackerNewsStory(title, uri, author, points, comments, rank)); }