public void EmptyReviewIsNull()
        {
            HtmlDocument doc    = new();
            Review       review = ReviewLogic.ParseReview(doc);

            Assert.IsNull(review);
        }
        public void ReviewsCountIsFifty()
        {
            List <HtmlDocument> htmlDocList = ReviewLogic.GetReviews(SettingsLogic.GetURL());
            List <Review>       reviewList  = ReviewLogic.ParseReviews(htmlDocList);

            Assert.IsTrue(reviewList.Count == 50);
        }
        public void TestAddReview()
        {
            //Arrange
            List <Review> reviews = new List <Review>
            {
                new Review(DateTime.Now, "Great Movie", "Simon", 4),
                new Review(DateTime.Now, "Excellent", "Henk", 5)
            };

            Review review = new Review(DateTime.Now, "", "Sebastian", 4);

            Mock <IReviewContext> mock = new Mock <IReviewContext>();

            mock.Setup(x => x.GetReviews(1)).Returns(reviews);
            ReviewLogic logic = new ReviewLogic(mock.Object);

            ReviewController controller = new ReviewController(logic);

            //Act
            var result = controller.AddReview(1, "Shrek", review.Date, review.Text, review.StarRating)
                         as ViewResult;

            var viewmodel = result.Model as ReviewViewModel;

            //Assert
            Assert.Equal("Please insert all fields", viewmodel.Message);
        }
 public void SetUp()
 {
     rLogic = new ReviewLogic(new TestReviewApiMethods());
     bLogic = new BreweryLogic(new TestBreweryApiMethods());
     bLogic.PostBrewery(brewery);
     controller = new ReviewController(rLogic, bLogic);
 }
Example #5
0
 public VolunteerController(QuestionLogic questionLogic, UserLogic userLogic, ReactionLogic reactionLogic, ChatLogic chatLogic, AppointmentLogic appointmentLogic, ReviewLogic reviewLogic)
 {
     _questionLogic    = questionLogic;
     _userLogic        = userLogic;
     _reactionLogic    = reactionLogic;
     _chatLogic        = chatLogic;
     _appointmentLogic = appointmentLogic;
     _reviewLogic      = reviewLogic;
 }
Example #6
0
 public ReviewController(QuestionLogic questionLogic, CategoryLogic categoryLogic, ReactionLogic reactionLogic, UserLogic userLogic, ChatLogic chatLogic, ReviewLogic reviewLogic)
 {
     _questionLogic = questionLogic;
     _categoryLogic = categoryLogic;
     _reactionLogic = reactionLogic;
     _userLogic     = userLogic;
     _chatLogic     = chatLogic;
     _reviewLogic   = reviewLogic;
 }
        public void ParseReviewNotNull()
        {
            HtmlDocument doc = new();

            doc.Load("../../../ParseReviewNotNull.html");

            Review review = ReviewLogic.ParseReview(doc);

            Assert.IsNotNull(review);
        }
Example #8
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Fetching Reviews....");
            List <HtmlDocument> htmlDocList = ReviewLogic.GetReviews(SettingsLogic.GetURL());
            List <Review>       reviews     = ReviewLogic.ParseReviews(htmlDocList);

            ScoreLogic.CalculateScores(reviews);
            ReviewLogic.PrintReviewsToConsole(reviews);

            Console.WriteLine("Press enter to close.");
            Console.ReadLine();
        }
        public ReviewControllerTests()
        {
            logicmock   = new Mock <IReviewLogic>();
            sessionmock = new Mock <IUserSession>();

            repositorymock = new Mock <IReviewRepository>();

            logic      = new ReviewLogic(repositorymock.Object);
            controller = new ReviewController(logicmock.Object, sessionmock.Object);

            reviews = new List <Review>
            {
                new Review(DateTime.Now, "Great Movie", "Simon", 4),
                new Review(DateTime.Now, "Excellent", "Henk", 5)
            };
        }
        public void TestGetReviews()
        {
            //Arrange
            List <Review> reviews = new List <Review>
            {
                new Review(DateTime.Now, "Great Movie", "Simon", 4),
                new Review(DateTime.Now, "Excellent", "Henk", 5)
            };

            Mock <IReviewContext> mock = new Mock <IReviewContext>();

            mock.Setup(x => x.GetReviews(1)).Returns(reviews);
            ReviewLogic logic = new ReviewLogic(mock.Object);

            ReviewController controller = new ReviewController(logic);

            //Act
            ViewResult result    = controller.NewReview(1, "Shrek") as ViewResult;
            var        viewmodel = result.Model as ReviewViewModel;

            //Assert
            Assert.Equal(2, viewmodel.Reviews.Count);
        }
        public void ReviewHtmlIsNotNull()
        {
            List <HtmlDocument> htmlDocList = ReviewLogic.GetReviews(SettingsLogic.GetURL());

            Assert.IsFalse(string.IsNullOrWhiteSpace(htmlDocList[0].Text));
        }
Example #12
0
 public ReviewController(ReviewLogic rLogic, BreweryLogic bLogic)
 {
     revLogic  = rLogic;
     brewLogic = bLogic;
 }
Example #13
0
 public ReviewController()
 {
     revLogic  = new ReviewLogic();
     brewLogic = new BreweryLogic();
 }
Example #14
0
 public ReviewLogicTests()
 {
     repositorymock = new Mock <IReviewRepository>();
     logic          = new ReviewLogic(repositorymock.Object);
 }
Example #15
0
 public ReviewController(ReviewLogic reviewlogic)
 {
     _context = reviewlogic;
 }
        public void RatingParsesCorrectly()
        {
            string ratingHtml = "rating-45 pull-right";

            Assert.IsTrue(ReviewLogic.ParseRating(ratingHtml) == 45);
        }
        public void BadRatingParsesCorrectly()
        {
            string ratingHtml = "asdfasdf pull-right";

            Assert.IsTrue(ReviewLogic.ParseRating(ratingHtml) == 0);
        }
        public void DocListIsNull()
        {
            List <HtmlDocument> htmlDocList = ReviewLogic.GetReviews("");

            Assert.IsNull(htmlDocList);
        }
Example #19
0
 public ReviewLogicTests()
 {
     _context = new Mock <IReviewContext>();
     logic    = new ReviewLogic(_context.Object);
 }
        public void BadURLTest()
        {
            List <HtmlDocument> htmlDocList = ReviewLogic.GetReviews("https://google.com/;alksdfj;alsdkj");

            Assert.IsTrue(htmlDocList.Count == 0);
        }
Example #21
0
 public void TestInitializer()
 {
     _reviewContext = new ReviewContextMock();
     _reviewLogic   = new ReviewLogic(_reviewContext);
 }
        public void ReviewCountIsFive()
        {
            List <HtmlDocument> htmlDocList = ReviewLogic.GetReviews(SettingsLogic.GetURL());

            Assert.IsTrue(htmlDocList.Count == 5);
        }