private void CreatePreKClass(EllCoach coach) { int schoolYear = DateTime.Now.Year; DateTime testSessionDate = new DateTime(schoolYear, 10, 1); DateTime testResultDate = testSessionDate.AddDays(14); Department department = Department.EarlyChildhood; Term term = CreateTerm(SchoolTerm.Fall, schoolYear); terms.Add(term); Course course = new Course("PreKindergarten General Education", department); GradeCourse gradeCourse = new GradeCourse(course, SchoolGrade.PreKindergarten); TermCourse termCourse = new TermCourse(term, gradeCourse); Instructor instructor = personCreator.CreatePerson <Instructor>(); instructor.Department = department; List <Assistant> assistants = personCreator.CreatePeople <Assistant>(2); List <Student> students = personCreator.CreateStudents(20, schoolYear - 4); SchoolClass schoolClass = new SchoolClass("Section A"); classAssigner.AssignClass(schoolClass, instructor, assistants, coach, students, termCourse); Test widaTest = testBuilder.Build(); TestSession session = new TestSession("Fall Test Session 1", testSessionDate, widaTest); courseManager.AddTestSession(session, schoolClass.CourseAssignment); students.ForEach(student => widaTest.Sections.ForEach(section => testAssigner.AssignTest(student.Enrollments[0], session, ((IWidaTestBuilder)testBuilder).BuildResult(section, testResultDate)))); classes.Add(schoolClass); }
public TestsController_GeneratingTests() { generators = new IExerciseGenerator[] { new OpenQuestionExerciseGenerator(), new MatchingQuestionExerciseGenerator(), new ChoiceQuestionExerciseGenerator() }; exercises = new Exercise[0]; cards = new List <Card> { new Card("t1", "d1", "admin", id), new Card("t2", "d2", "admin", id) }; collection = new Collection("coll", "admin", id); testQuery = new TestQueryDto(id, new List <TestBlockDto> { new TestBlockDto(generators[0].GetTypeCaption(), 1), new TestBlockDto(generators[1].GetTypeCaption(), 2), new TestBlockDto(generators[2].GetTypeCaption(), 3) }, null); fakeStorage = A.Fake <IStorage>(); fakeTestStorage = A.Fake <ITestStorage>(); factory = A.Fake <ITestBuilderFactory>(); fakeBuilder = A.Fake <ITestBuilder>(); A.CallTo(() => fakeStorage.FindCollection(A <Guid> ._, A <CancellationToken> ._)).Returns(collection); A.CallTo(() => fakeStorage.GetCollectionCards(id, A <CancellationToken> ._)).Returns(cards); A.CallTo(() => fakeBuilder.Build()).Returns(exercises); A.CallTo(() => fakeBuilder.WithGenerator(A <IExerciseGenerator> ._, A <int> ._)).Returns(fakeBuilder); A.CallTo(() => factory.GetBuilder(cards, A <ICardsSelector> ._)).Returns(fakeBuilder); controller = new TestsController(fakeStorage, fakeTestStorage, factory, generators, null); ControllerTestsHelper.AttachUserToControllerContext(controller, "admin"); }