public void PerformanceTestAverageScoreById()
        {
            MovieSystem _ms        = new MovieSystem("ratings.json");
            int         reviewerId = 3;
            var         stopwatch  = new Stopwatch();

            stopwatch.Start();
            _ms.AverageScoreById(reviewerId);
            stopwatch.Stop();

            var  stop         = stopwatch.ElapsedMilliseconds;
            long expectedTime = 4000;

            Assert.True(stop <= expectedTime);
        }
        public void TestAverageScoreById(double expAverage, int reviewerId)
        {
            List <Movie> movies = new List <Movie>()
            {
                new Movie {
                    Reviewer = 1, Grade = 1
                },
                new Movie {
                    Reviewer = 1, Grade = 1
                },
                new Movie {
                    Reviewer = 2, Grade = 2
                },
                new Movie {
                    Reviewer = 2, Grade = 3
                },
                new Movie {
                    Reviewer = 3, Grade = 4
                }
            };
            MovieSystem ms = new MovieSystem(movies);

            Assert.Equal(expAverage, ms.AverageScoreById(reviewerId));
        }
        public void TestExceptionThrownByAverageScoreById(int reviewerId)
        {
            List <Movie> movies = new List <Movie>()
            {
                new Movie {
                    Reviewer = 1, Grade = 1
                },
                new Movie {
                    Reviewer = 1, Grade = 1
                },
                new Movie {
                    Reviewer = 2, Grade = 2
                },
                new Movie {
                    Reviewer = 2, Grade = 3
                },
                new Movie {
                    Reviewer = 3, Grade = 4
                }
            };
            MovieSystem ms = new MovieSystem(movies);

            Assert.Throws <InvalidDataException>(() => ms.AverageScoreById(reviewerId));
        }