pluralsight-csharp-fundamen.../gradebook/test/GradeBook.Tests/BookTests.cs

28 lines
674 B
C#
Raw Normal View History

using System;
using Xunit;
namespace GradeBook.Tests
{
public class BookTests
{
[Fact]
public void BookCalculateAnAverageGrade()
{
// arrange
2021-02-22 23:26:08 +11:00
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);
2021-02-19 15:33:27 +11:00
Assert.Equal('B', result.Letter);
}
}
}