public async Task GetSectionAsync_DoesntExist_ReturnNull()
		{
			var database = new TestDatabaseBuilder()
				.AddClassroom("Class1")
				.Build();

			var sectionService = new SectionService(database.Context);
			var section = await sectionService.GetSectionAsync("Class1", "Section1");

			Assert.Null(section);
		}
		public async Task GetSectionAsync_Exists_ReturnSection()
		{
			var database = new TestDatabaseBuilder()
				.AddClassroom("Class1")
				.AddSection("Class1", "Section1")
				.Build();

			database.Reload();

			var sectionService = new SectionService(database.Context);
			var section = await sectionService.GetSectionAsync("Class1", "Section1");

			Assert.Equal("Class1", section.Classroom.Name);
			Assert.Equal("Section1", section.Name);
		}
		public async Task GetSectionMembershipsAsync_ReturnStudents()
		{
			var database = new TestDatabaseBuilder()
				.AddClassroom("Class1")
				.AddSection("Class1", "Section1")
				.AddSection("Class1", "Section2")
				.AddStudent("User1", "Last", "First", "Class1", "Section1")
				.AddStudent("User2", "Last", "First", "Class1", "Section1")
				.AddStudent("User3", "Last", "First", "Class1", "Section2")
				.Build();

			database.Reload();

			var sectionService = new SectionService(database.Context);
			var students = await sectionService.GetSectionStudentsAsync("Class1", "Section1");

			Assert.Equal(2, students.Count);
			Assert.Equal("User1", students[0].ClassroomMembership.User.UserName);
			Assert.Equal("User2", students[1].ClassroomMembership.User.UserName);
		}
		public async Task CreateSectionAsync_SectionCreated()
		{
			var database = new TestDatabaseBuilder()
				.AddClassroom("Class1")
				.Build();

			var sectionService = new SectionService(database.Context);
			await sectionService.CreateSectionAsync
			(
				"Class1",
				new Section()
				{
					Name = "Section1"
				}
			);

			database.Reload();

			var section = database.Context.Sections
				.Include(qc => qc.Classroom)
				.Single();

			Assert.Equal("Class1", section.Classroom.Name);
			Assert.Equal("Section1", section.Name);
		}
		public async Task DeleteSectionAsync_SectionDeleted()
		{
			var database = new TestDatabaseBuilder()
				.AddClassroom("Class1")
				.AddSection("Class1", "Section1")
				.Build();
			
			database.Reload();

			var sectionService = new SectionService(database.Context);
			await sectionService.DeleteSectionAsync("Class1", "Section1");

			database.Reload();

			Assert.Equal(0, database.Context.Sections.Count());
		}
		public async Task UpdateSectionAsync_SectionUpdated()
		{
			var database = new TestDatabaseBuilder()
				.AddClassroom("Class1")
				.AddSection("Class1", "Section1")
				.Build();

			var section = database.Context.Sections
				.Include(qc => qc.Classroom)
				.First();

			// Update the section
			database.Context.Entry(section).State = EntityState.Detached;
			section.DisplayName = "New Display Name";

			// Apply the update
			var sectionService = new SectionService(database.Context);
			await sectionService.UpdateSectionAsync("Class1", section);

			database.Reload();

			section = database.Context.Sections
				.Include(qc => qc.Classroom)
				.Single();

			Assert.Equal("Class1", section.Classroom.Name);
			Assert.Equal("Section1", section.Name);
			Assert.Equal("New Display Name", section.DisplayName);
		}