public void GetTopTen_PerfectFile() { ResetFile(); movieRatingApp.ImportData(true); List <ReviewSummaryItem> topTen = movieRatingApp.GetTopTen(); Assert.AreEqual(10, topTen.Count); for (int i = 1; i < topTen.Count; i++) { ReviewSummaryItem currentItem = topTen[i]; ReviewSummaryItem itemOnTop = topTen[i - 1]; Assert.IsTrue(currentItem.Rating <= itemOnTop.Rating); } }
public void GetTopTen_FileWithOnlyNineMovies() { ResetFile(); string[] fileContent = File.ReadAllLines(this.filePath); fileContent[0] = string.Empty; fileContent[10] = string.Empty; File.Delete(this.filePath); File.WriteAllLines(this.filePath, fileContent); movieRatingApp.ImportData(true); List <ReviewSummaryItem> topTen = movieRatingApp.GetTopTen(); Assert.AreEqual(9, topTen.Count); for (int i = 1; i < topTen.Count; i++) { ReviewSummaryItem currentItem = topTen[i]; ReviewSummaryItem itemOnTop = topTen[i - 1]; Assert.IsTrue(currentItem.Rating <= itemOnTop.Rating); } }