28 lines
674 B
C#
28 lines
674 B
C#
using System;
|
|
using Xunit;
|
|
|
|
namespace GradeBook.Tests
|
|
{
|
|
public class BookTests
|
|
{
|
|
[Fact]
|
|
public void BookCalculateAnAverageGrade()
|
|
{
|
|
// arrange
|
|
var book = new InMemoryBook("");
|
|
book.AddGrade(89.1);
|
|
book.AddGrade(90.5);
|
|
book.AddGrade(77.3);
|
|
|
|
// act
|
|
var result = book.GetStatistics();
|
|
|
|
// assert
|
|
Assert.Equal(85.6, result.Average, 1);
|
|
Assert.Equal(90.5, result.highGrade);
|
|
Assert.Equal(77.3, result.lowGrade);
|
|
Assert.Equal('B', result.Letter);
|
|
}
|
|
}
|
|
}
|