public void GetGradesReturnsEmptyEnumerableIfGradesIsEmpty() { var book = new InMemoryBook("grades", new LetterGrade()); var grades = book.GetGrades(); Assert.Empty(grades); }
public void BookWontAcceptInvalidGrade() { // arrange var book = new InMemoryBook("Test Book"); book.AddGrade(-5.0); book.AddGrade(344); var grades = book.GetGrades(); // assert Assert.Equal(0, grades.Count); }
public void AddGrade_Test() { //arrange var book = new InMemoryBook(""); //action book.AddGrade(100); var grades = book.GetGrades(); //assert Assert.True(grades.Count >= 1); }
public void AddGradeWhenLessThan100AndGreaterThan0() { var book = new InMemoryBook(""); book.AddGrade(90); var grades = book.GetGrades(); Assert.Equal(new List <double> { 90 }, grades); Assert.Single(grades); }
public void AddLetterGradeOther() { var book = new InMemoryBook(""); book.AddLetterGrade('Z'); var grades = book.GetGrades(); Assert.Single(grades); Assert.Equal(new List <double> { 0 }, grades); }
public void GetGrades() { var book = new InMemoryBook("grades", new LetterGrade()); book.AddGrade(100); book.AddGrade(70); book.AddGrade(80); var grades = book.GetGrades(); Assert.Contains(100, grades); Assert.Contains(70, grades); Assert.Contains(80, grades); }
public void NoGradeAddedWhenGreaterThan100() { var book = new InMemoryBook(""); try { book.AddGrade(395); } catch (Exception ex) { _testOutputHelper.WriteLine(ex.Message); } var grades = book.GetGrades(); Assert.Empty(grades); }
public void BookCalculatesAnAverageGradesFromCLIInput() { // arrange var book = new InMemoryBook("InMemoryBook of Water"); book.AddGrade(60); book.AddGrade(90); book.AddGrade(70); book.AddGrade(60); book.AddGrade(10); book.AddGrade(10); // act var result = book.GetStatistics(); //assert Assert.Equal(book.GetMaxGradeCount(), book.GetGrades().Count); Assert.Equal(280, result.Total); Assert.Equal(70, result.Average); Assert.Equal(90, result.High); Assert.Equal(60, result.Low); Assert.Equal('C', result.Letter); }