예제 #1
0
        public void AverageForTwoReviewsIsMean()
        {
            var reviewStore = new ReviewStore();
            var m           = new Movie("The Abyss");
            var review      = new Review
            {
                Rating = 3
            };
            var review2 = new Review
            {
                Rating = 4
            };

            reviewStore.LeaveReviewFor(m, review);
            reviewStore.LeaveReviewFor(m, review2);
            Assert.AreEqual(3.5, reviewStore.CalculateAverageFor(m));
        }
예제 #2
0
        public void AverageForOneReviewIsValue()
        {
            var reviewStore = new ReviewStore();
            var m           = new Movie("The Abyss");
            var review      = new Review
            {
                Rating = 3
            };

            reviewStore.LeaveReviewFor(m, review);
            Assert.AreEqual(3, reviewStore.CalculateAverageFor(m));
        }
예제 #3
0
        public void CanLeaveReview()
        {
            var reviewStore = new ReviewStore();
            var m           = new Movie("The Abyss");
            // reviewStore.Register(m);
            var r = new Review
            {
                Rating       = 1,
                ReviewerName = "Bob",
                ReviewText   = "Couldn't get into"
            };

            reviewStore.LeaveReviewFor(m, r);
            Assert.IsTrue(reviewStore.ContainsReviewFor(m, r));
        }
예제 #4
0
        public void TableForMovieIsValueIfOneReview()
        {
            var reviewStore = new ReviewStore();
            var m           = new Movie("The Abyss");
            var review      = new Review
            {
                Rating = 3
            };

            reviewStore.LeaveReviewFor(m, review);

            var table = reviewStore.GetTableFor(m);

            Assert.AreEqual(1, table[3]);
            Assert.AreEqual(0, table[1]);
            Assert.AreEqual(0, table[2]);
            Assert.AreEqual(0, table[4]);
            Assert.AreEqual(0, table[5]);
        }