passing canvas models tests

This commit is contained in:
2023-01-04 22:03:35 -07:00
parent ed897bc96e
commit ac2e9f63d6
2 changed files with 38 additions and 3 deletions

View File

@@ -1,4 +1,13 @@
using CanvasModel.EnrollmentTerms;
public class SemesterPlanner
{
public IEnumerable<CalendarMonth> Months { get; }
public SemesterPlanner(EnrollmentTermModel canvasTerm)
{
var monthsInTerm = canvasTerm.EndAt?.Month - canvasTerm.StartAt?.Month
?? throw new Exception($"Canvas Term must have a start and end date. Term: {canvasTerm.Id}, start: {canvasTerm.StartAt}, end: {canvasTerm.EndAt}");
Months = Enumerable.Range(1, monthsInTerm).Select(_ => new CalendarMonth());
}
}