Skip to content

Instantly share code, notes, and snippets.

@safestudent
Created December 4, 2018 12:18
Show Gist options
  • Save safestudent/939a1aba631d98e19d611760283314c6 to your computer and use it in GitHub Desktop.
Save safestudent/939a1aba631d98e19d611760283314c6 to your computer and use it in GitHub Desktop.
AverageActualPointsModelTest
public void EmptyList()
{
// ARRANGE
// Initialise the Statistics class
Statistics stats = new Statistics();
// Set up 'in memory' database (can’t mock a context)
var options = new
DbContextOptionsBuilder<SprintTrackerWebContext>()
.UseInMemoryDatabase(databaseName: "Add_writes_to_database").Options;
// Create a context so we can talk to the empty database
var context = new SprintTrackerWebContext(options);
// ACT: get the average points from the sprints
var result = stats.GetAveragePoints(context);
// ASSERT: Test the result
Assert.Equal(0.0, result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment