Beispiel #1
0
        // Returns factory function for the exam application
        public Func <IExamApplication> GetExamApplicationFactory(Subject examOn, Professor administratedBy)
        {
            ExamApplicationBuilder builder = new ExamApplicationBuilder();

            builder.OnSubject(examOn);
            builder.AdministratedBy(administratedBy);
            builder.TakenBy(this);

            if (builder.CanBuild())
            {
                return(builder.Build);
            }

            // think of something smarter;
            throw new ArgumentException();
        }
Beispiel #2
0
        public IExamApplication ApplyFor([NotNull] IExam exam)
        {
            ExamApplicationBuilder builder = new ExamApplicationBuilder();

            builder.OnSubject(exam.OnSubject);
            builder.AdministratedBy(exam.AdministratedBy);
            builder.TakenBy(this);

            IExamApplication application = builder.Build();

            this.Exams.Add(application);

            return(application);

            //if (!CanApplyFor(exam))
            //    throw new ArgumentException();

            //return new Implementation.ExamApplication(new Exam(exam.OnSubject, exam.AdministratedBy), this);
        }