Beispiel #1
0
        static void Main(string[] args)
        {
            IStudentManager studentManager = new StudentManager();

            studentManager.AddStudent("Adam", 15);
            studentManager.AddStudent("Bertil", 17);
            studentManager.AddStudent("Ceasar", 21);
            studentManager.AddStudent("David", 65);

            ITeacherManager teacherManager = new TeacherManager();

            teacherManager.AddTeacher("Kalle");

            ICourseManager courseManager = new CourseManager();

            courseManager.AddCourse("C#", "Kalle");
            courseManager.AddCourse("Datalagring med .Net", "Kalle");

            IExamManager examManager = new ExamManager();
            var          exam1       = examManager.AddExam("C#", 0.4m);
            var          exam2       = examManager.AddExam("C#", 0.6m);

            var question1 = examManager.AddQuestion(exam1, "Vad är ett interface?");
            var option1   = examManager.AddAnswerOption(question1, "En grej i C#", true);
            var option2   = examManager.AddAnswerOption(question1, "En sorts fisk", false);

            var question2 = examManager.AddQuestion(exam1, "Vad är en klass?");
            var option3   = examManager.AddAnswerOption(question2, "En annan grej i C#", true);
            var option4   = examManager.AddAnswerOption(question2, "En sorts insekt", false);

            var question3 = examManager.AddQuestion(exam2, "Vad är Entity Framework?");
            var option5   = examManager.AddAnswerOption(question3, "En ORM i C#", true);
            var option6   = examManager.AddAnswerOption(question3, "En sorts däggdjur", false);


            IExamAnswerManager examAnswerManager = new ExamAnswerManager();
            var examAnswer1 = examAnswerManager.AddExamAnswer("Adam", exam1);

            examAnswerManager.AddExamQuestionAnswer(examAnswer1, question1, option1);
            examAnswerManager.AddExamQuestionAnswer(examAnswer1, question2, option4);

            var examAnswer2 = examAnswerManager.AddExamAnswer("Adam", exam2);

            examAnswerManager.AddExamQuestionAnswer(examAnswer2, question2, option5);


            ITestResultManager testResultManager = new TestResultManager();
            var examGrader = new ExamGrader(testResultManager, examAnswerManager);

            examGrader.GradeExam("Adam", "C#", 0);
            Console.WriteLine("Klart.");
            Console.ReadLine();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            IStudentManager studentManager = new StudentManager();

            studentManager.AddStudent("Joel", 28);
            studentManager.AddStudent("Ruben", 38);
            studentManager.AddStudent("Sandra", 19);
            studentManager.AddStudent("Daniel", 43);
            studentManager.AddStudent("Mattias", 23);
            studentManager.AddStudent("Hanna", 29);
            studentManager.AddStudent("Rebecka", 32);
            studentManager.AddStudent("Jenny", 46);

            ITeacherManager teacherManager = new TeacherManager();

            teacherManager.AddTeacher("Gösta");
            teacherManager.AddTeacher("Per");
            teacherManager.AddTeacher("Lars");
            teacherManager.AddTeacher("Sven");

            ICourseManager courseManager = new CourseManager();

            courseManager.AddCourse("C#", "Gösta");
            courseManager.AddCourse("Datalagring med .Net", "Gösta");
            courseManager.AddCourse("Iot", "Per");
            courseManager.AddCourse("Internet of Things", "Per");
            courseManager.AddCourse("CAD", "Lars");
            courseManager.AddCourse("CAD-ritare", "Lars");
            courseManager.AddCourse("IT", "Sven");
            courseManager.AddCourse("Datorteknik & Nätverk", "Sven");

            IExamManager examManager = new ExamManager();
            var          exam1       = examManager.AddExam("C#", 0.4m);
            var          exam2       = examManager.AddExam("C#", 0.6m);

            var question1 = examManager.AddQuestion(exam1, "När använder man bool?");
            var option1   = examManager.AddAnswerOption(question1, "När man returar något", true);
            var option2   = examManager.AddAnswerOption(question1, "När man anropar något", false);

            var question2 = examManager.AddQuestion(exam1, "Vad är class?");
            var option3   = examManager.AddAnswerOption(question2, "En annan grej i C#", true);
            var option4   = examManager.AddAnswerOption(question2, "En sorts insekt", false);

            var question3 = examManager.AddQuestion(exam2, "Vad är Entity Framework?");
            var option5   = examManager.AddAnswerOption(question3, "En ORM i C#", true);
            var option6   = examManager.AddAnswerOption(question3, "En sorts däggdjur", false);

            IExamManager examManager1 = new ExamManager();
            var          exam3        = examManager.AddExam("IoT", 0.8m);
            var          exam4        = examManager.AddExam("IoT", 0.5m);

            var question4 = examManager.AddQuestion(exam3, "Vad är IoT?");
            var option7   = examManager.AddAnswerOption(question4, "Lastbil", false);
            var option8   = examManager.AddAnswerOption(question4, "En grej i Iot", true);

            IExamAnswerManager examAnswerManager = new ExamAnswerManager();
            var examAnswer1 = examAnswerManager.AddExamAnswer("Joel", exam1);

            examAnswerManager.AddExamQuestionAnswer(examAnswer1, question1, option1);
            examAnswerManager.AddExamQuestionAnswer(examAnswer1, question2, option4);

            var examAnswer2 = examAnswerManager.AddExamAnswer("Joel", exam2);

            examAnswerManager.AddExamQuestionAnswer(examAnswer2, question2, option5);

            var examAnswer = examAnswerManager.GetAnswer("Joel", exam1);
            var examGrader = new ExamGrader();

            examGrader.GradeExam(examAnswer);
            Console.WriteLine("Klart.");
            Console.ReadLine();
        }