Пример #1
0
        public void AddingTwoReviewsWithDifferantValuesHasAverageBetweenThem()
        {
            var movie = new Movie();

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

            Assert.That(movie.AverageRating, Is.EqualTo(3));
        }
Пример #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));
        }
Пример #3
0
        public void AddingASingleReviewHasAverageRatingOfThatReview(int review)
        {
            var movie = new Movie();

            movie.AddReview(review);

            Assert.That(movie.AverageRating, Is.EqualTo(review));
        }
Пример #4
0
        public void AddingAReviewIncreaseNumberOfReviewsToOne()
        {
            var movie = new Movie();

            movie.AddReview(AnyRating);

            Assert.That(movie.TotalReviews, Is.EqualTo(1));
        }
Пример #5
0
        public void CanSpecifyReviewText()
        {
            var movie = new Movie();

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

            Assert.That(movie.LatestReviewText, Is.Not.Empty);
        }
Пример #6
0
        public void ReviewTextIsInitiallyEmpty()
        {
            var movie = new Movie();

            movie.AddReview(AnyRating);

            Assert.That(movie.LatestReviewText, Is.Empty);
        }
Пример #7
0
        public void CanSpecifyReviewer()
        {
            var movie = new Movie();

            movie.AddReview(AnyRating, "ReviewerName");

            Assert.That(movie.LatestReviewer, Is.EqualTo("ReviewerName"));
        }
Пример #8
0
        public void DefaultReviewerIsAnonymous()
        {
            var movie = new Movie();

            movie.AddReview(AnyRating);

            Assert.That(movie.LatestReviewer, Is.EqualTo("Anonymous"));
        }
Пример #9
0
        public void AddingOneReviewAddOneToThatRatingGroup()
        {
            var movie = new Movie();

            movie.AddReview(AnyRating);

            var numberOfReviewsForRating = movie.NumberOfReviewsForRating(AnyRating);

            Assert.That(numberOfReviewsForRating, Is.EqualTo(1));
        }
Пример #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);
        }
Пример #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);
        }
Пример #12
0
        public void AddingOutOfBoundsRatingCausesException(int rating)
        {
            var movie = new Movie();

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