public void PerformanceTestMovieReviews() { MovieSystem _ms = new MovieSystem("ratings.json"); int movieId = 41422; var stopwatch = new Stopwatch(); stopwatch.Start(); _ms.MovieReviews(movieId); stopwatch.Stop(); var stop = stopwatch.ElapsedMilliseconds; long expectedTime = 4000; Assert.True(stop <= expectedTime); }
public void TestExceptionThrownByMovieReviews(int movieId) { List <Movie> movies = new List <Movie>() { new Movie { Reviewer = 1, Grade = 1, MovieId = 1 }, new Movie { Reviewer = 1, Grade = 1, MovieId = 2 }, new Movie { Reviewer = 2, Grade = 2, MovieId = 3 }, new Movie { Reviewer = 2, Grade = 3, MovieId = 3 }, new Movie { Reviewer = 3, Grade = 4, MovieId = 2 } }; MovieSystem ms = new MovieSystem(movies); Assert.Throws <InvalidDataException>(() => ms.MovieReviews(movieId)); }
public void TestMovieReviews(int expAmount, int movieId) { List <Movie> movies = new List <Movie>() { new Movie { Reviewer = 1, Grade = 1, MovieId = 1 }, new Movie { Reviewer = 1, Grade = 1, MovieId = 2 }, new Movie { Reviewer = 2, Grade = 2, MovieId = 3 }, new Movie { Reviewer = 2, Grade = 3, MovieId = 3 }, new Movie { Reviewer = 3, Grade = 4, MovieId = 2 } }; MovieSystem ms = new MovieSystem(movies); Assert.Equal(expAmount, ms.MovieReviews(movieId)); }