public void PerformanceTestAmountOfGradesGivenById() { MovieSystem _ms = new MovieSystem("ratings.json"); int movieId = 1009622; int grade = 3; var stopwatch = new Stopwatch(); stopwatch.Start(); _ms.AmountOfGradesGivenById(movieId, grade); stopwatch.Stop(); var stop = stopwatch.ElapsedMilliseconds; long expectedTime = 4000; Assert.True(stop <= expectedTime); }
public void TestAmountOfGradesGivenById(double expAmount, int movieId, int grade) { 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 = 2, MovieId = 3 }, new Movie { Reviewer = 3, Grade = 4, MovieId = 2 } }; MovieSystem ms = new MovieSystem(movies); Assert.Equal(expAmount, ms.AmountOfGradesGivenById(movieId, grade)); }