public void TestReviewsById(int id, int expResult) { List <Movie> movies = new List <Movie>() { new Movie { Reviewer = 1 }, new Movie { Reviewer = 1 }, new Movie { Reviewer = 2 }, new Movie { Reviewer = 2 }, new Movie { Reviewer = 3 }, }; MovieSystem ms = new MovieSystem(movies); int result = ms.ReviewsById(id); Assert.Equal(result, expResult); }
public void PerformanceTestReviewsById() { MovieSystem _ms = new MovieSystem("ratings.json"); var stopwatch = new Stopwatch(); int id = 3; stopwatch.Start(); _ms.ReviewsById(id); stopwatch.Stop(); var stop = stopwatch.ElapsedMilliseconds; long expectedTime = 4000; Assert.True(stop <= expectedTime); }
public void TestExceptionThrownByReviewsById(int reviewer) { List <Movie> movies = new List <Movie>() { new Movie { Reviewer = 1 }, new Movie { Reviewer = 1 }, new Movie { Reviewer = 2 }, new Movie { Reviewer = 2 }, new Movie { Reviewer = 3 } }; MovieSystem ms = new MovieSystem(movies); Assert.Throws <InvalidDataException>(() => ms.ReviewsById(reviewer)); }