Esempio n. 1
0
        public void AddingTwoReviewsWithDifferantValuesHasAverageBetweenThem()
        {
            var movie = new Movie();

            movie.AddReview(1);
            movie.AddReview(5);

            Assert.That(movie.AverageRating, Is.EqualTo(3));
        }
Esempio n. 2
0
        public void AddingOneReviewToTwoRatingGroups()
        {
            var movie = new Movie();

            movie.AddReview(1);
            movie.AddReview(2);

            var numberOfReviewsForRating1 = movie.NumberOfReviewsForRating(1);

            Assert.That(numberOfReviewsForRating1, Is.EqualTo(1));

            var numberOfReviewsForRating2 = movie.NumberOfReviewsForRating(2);

            Assert.That(numberOfReviewsForRating2, Is.EqualTo(1));
        }
Esempio n. 3
0
        public void AddingASingleReviewHasAverageRatingOfThatReview(int review)
        {
            var movie = new Movie();

            movie.AddReview(review);

            Assert.That(movie.AverageRating, Is.EqualTo(review));
        }
Esempio n. 4
0
        public void AddingAReviewIncreaseNumberOfReviewsToOne()
        {
            var movie = new Movie();

            movie.AddReview(AnyRating);

            Assert.That(movie.TotalReviews, Is.EqualTo(1));
        }
Esempio n. 5
0
        public void CanSpecifyReviewText()
        {
            var movie = new Movie();

            movie.AddReview(AnyRating, null, "reviewText");

            Assert.That(movie.LatestReviewText, Is.Not.Empty);
        }
Esempio n. 6
0
        public void ReviewTextIsInitiallyEmpty()
        {
            var movie = new Movie();

            movie.AddReview(AnyRating);

            Assert.That(movie.LatestReviewText, Is.Empty);
        }
Esempio n. 7
0
        public void CanSpecifyReviewer()
        {
            var movie = new Movie();

            movie.AddReview(AnyRating, "ReviewerName");

            Assert.That(movie.LatestReviewer, Is.EqualTo("ReviewerName"));
        }
Esempio n. 8
0
        public void DefaultReviewerIsAnonymous()
        {
            var movie = new Movie();

            movie.AddReview(AnyRating);

            Assert.That(movie.LatestReviewer, Is.EqualTo("Anonymous"));
        }
Esempio n. 9
0
        public void AddingOneReviewAddOneToThatRatingGroup()
        {
            var movie = new Movie();

            movie.AddReview(AnyRating);

            var numberOfReviewsForRating = movie.NumberOfReviewsForRating(AnyRating);

            Assert.That(numberOfReviewsForRating, Is.EqualTo(1));
        }
Esempio n. 10
0
        public void AddReview_ShouldThrowArgumentNullException_DueToArgumentBeingNull()
        {
            //Arrange
            var movie = new Movie();

            //Act
            var ex = Assert.Throws <ArgumentNullException>(() => movie.AddReview(null));

            //Assert
            Assert.Equal("Value cannot be null.", ex.Message);
        }
Esempio n. 11
0
        public void AddReview_ShouldAddReview()
        {
            //Arrange
            var movie = new Movie()
            {
                Title       = "asd",
                Runtime     = 1997,
                Year        = 2000,
                PosterPath  = null,
                Description = "Desc",
                Reviews     = new List <Review>()
            };
            var review = new Review();

            //Act
            movie.AddReview(review);

            //Assert
            Assert.Single(movie.Reviews);
        }
Esempio n. 12
0
        public void AddingOutOfBoundsRatingCausesException(int rating)
        {
            var movie = new Movie();

            Assert.Throws <ArgumentOutOfRangeException>(() => movie.AddReview(rating));
        }