private ProductReview GetReview(HtmlNode reviewNode)
        {
            var productReview = new ProductReview
            {
                Reviewer = "Komputronik.pl",
                AddedOn = GetAddedOn(reviewNode),
                Body = GetReviewBody(reviewNode),
                ScoreMark = GetScoreMark(reviewNode)
            };

            return productReview;
        }
Exemplo n.º 2
0
 public static async void Write(ProductReview productReview, string path)
 {
     using (var streamWriter = new StreamWriter(path, false, Encoding.UTF8))
     {
         streamWriter.WriteLine("Reviewer: {0}", productReview.Reviewer);
         streamWriter.WriteLine("ScoreMark: {0}", productReview.ScoreMark);
         streamWriter.WriteLine("Recommendation: {0}", productReview.Recommendation);
         streamWriter.WriteLine("AddedOn: {0}", productReview.AddedOn);
         streamWriter.WriteLine("ConsideredAsUsefulCount: {0}", productReview.ConsideredAsUsefulCount);
         streamWriter.WriteLine("UsefulnessBaseCount: {0}", productReview.UsefulnessBaseCount);
         streamWriter.WriteLine("ProductAdventages: {0}",string.Join("; ", productReview.ProductAdventages.Select(x => x.Feature)));
         streamWriter.WriteLine("ProductDisadvantages: {0}", string.Join("; ", productReview.ProductDisadvantages.Select(x => x.Feature)));
         streamWriter.WriteLine("Body: {0}", productReview.Body);
         
         await streamWriter.FlushAsync();
     }
 }
        private ProductReview GetReview(Tuple<HtmlNode, HtmlNode> reviewNode)
        {
            var productReview = new ProductReview
            {
                Reviewer = GetReviewer(reviewNode),
                AddedOn = GetAddedOn(reviewNode),
                Body = GetReviewBody(reviewNode),
                Recommendation = GetRecommendation(),
                ScoreMark = GetScoreMark(reviewNode),
                ConsideredAsUsefulCount = GetConsideredAsUsefulCount(reviewNode),
                UsefulnessBaseCount = GetUsefulnessBaseCount(reviewNode),
                ProductAdventages = GetProductAdventages(reviewNode),
                ProductDisadvantages = GetProductDisadvantages(reviewNode)
            };

            return productReview;
        }
Exemplo n.º 4
0
 protected bool Equals(ProductReview other)
 {
     return string.Equals(Body, other.Body)
         && string.Equals(Reviewer, other.Reviewer)
         && ScoreMark == other.ScoreMark
         && Recommendation == other.Recommendation
         && ConsideredAsUsefulCount == other.ConsideredAsUsefulCount
         && UsefulnessBaseCount == other.UsefulnessBaseCount
         && AddedOn.Equals(other.AddedOn);
 }
        private ProductReview GetReview(HtmlNode reviewNode)
        {
            var productReviewId = int.Parse(reviewNode.QuerySelector(".product-review-vote").Attributes["data-review-id"].Value);

            var productReview = new ProductReview
            {
                Reviewer = GetReviewer(reviewNode),
                AddedOn = GetAddedOn(reviewNode),
                Body = GetReviewBody(reviewNode),
                Recommendation = GetRecommendation(reviewNode),
                ScoreMark = GetScoreMark(reviewNode),
                ConsideredAsUsefulCount = GetConsideredAsUsefulCount(reviewNode, productReviewId),
                UsefulnessBaseCount = GetUsefulnessBaseCount(reviewNode, productReviewId),
                ProductAdventages = GetProductAdventages(reviewNode),
                ProductDisadvantages = GetProductDisadvantages(reviewNode)
            };

            return productReview;
        }