2021-02-17 13:30:04 +11:00
|
|
|
using System;
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
namespace GradeBook.Tests
|
|
|
|
{
|
|
|
|
public class BookTests
|
|
|
|
{
|
|
|
|
[Fact]
|
2021-02-18 12:41:40 +11:00
|
|
|
public void BookCalculateAnAverageGrade()
|
2021-02-17 13:30:04 +11:00
|
|
|
{
|
|
|
|
// arrange
|
|
|
|
var book = new Book("");
|
|
|
|
book.AddGrade(89.1);
|
|
|
|
book.AddGrade(90.5);
|
|
|
|
book.AddGrade(77.3);
|
|
|
|
|
|
|
|
// act
|
2021-02-17 23:33:05 +11:00
|
|
|
var result = book.GetStatistics();
|
|
|
|
|
|
|
|
// assert
|
|
|
|
Assert.Equal(85.6, result.Average, 1);
|
|
|
|
Assert.Equal(90.5, result.highGrade);
|
|
|
|
Assert.Equal(77.3, result.lowGrade);
|
2021-02-17 13:30:04 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|