public void TestAmountOfGradesById(int expAmount, int reviewerId, int grade) { 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); int amount = ms.AmountOfGradesById(reviewerId, grade); Assert.Equal(expAmount, amount); }
public void PerformanceTestAmountOfGradesById() { MovieSystem _ms = new MovieSystem("ratings.json"); var stopwatch = new Stopwatch(); int reviewerId = 1; int grade = 3; stopwatch.Start(); _ms.AmountOfGradesById(reviewerId, grade); stopwatch.Stop(); var stop = stopwatch.ElapsedMilliseconds; long expectedTime = 4000; Assert.True(stop <= expectedTime); }
public void TestExceptionThrownByAmountOfGradesById(int reviewerId, int grade) { 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.AmountOfGradesById(reviewerId, grade)); }