public async Task UpdateQuestionAsync_UpdatesTests_NoError() { var database = GetDatabase().Build(); var question = database.Context.ProgramQuestions .Include(q => q.Tests) .First(); database.Reload(); question.Tests.Clear(); question.Tests.Add(new ProgramQuestionTest() { Name = "NewTest1", ExpectedOutput = "Line1\r\nLine2" }); question.Tests.Add(new ProgramQuestionTest() { Name = "NewTest2", ExpectedOutput = "Line1\r\nLine2" }); var errors = new MockErrorCollection(); var updater = new ProgramQuestionUpdater(database.Context, question, errors); await updater.UpdateQuestionAsync(); database.Context.Questions.Update(question); database.Context.SaveChanges(); database.Reload(); question = database.Context.ProgramQuestions .Include(q => q.Tests) .First(); Assert.False(errors.HasErrors); Assert.Equal(2, question.Tests.Count); Assert.Equal("NewTest1", question.Tests[0].Name); Assert.Equal("NewTest2", question.Tests[1].Name); }