コード例 #1
0
        public TeacherEnvironmentView(Model.QuestionList list)
        {
            InitializeComponent();
            this.Size = new Size(1280, 720);
            this.Text = "Vragenlijst: " + list.Name;

            this.QuestionsListBox.DisplayMember = "Text";
            this.QuestionsListBox.ValueMember = "Id";
            this.QuestionsListBox.DataSource = this.Questions;

            DiagramView diagramView = new DiagramView();
            this.DiagramController = new DiagramController(diagramView);

            AddQuestionView addQuestionView = new AddQuestionView(null,true);
            AddQuestionController addQuestionController = new AddQuestionController();
            addQuestionController.SetView(addQuestionView);
            addQuestionController.SetQuestionList(list);

            //use the event, to close the docentform when clicked on Quit
            addQuestionController.RemoveAddQuestionPanel += CloseForm;
            addQuestionController.QuestionSavedSucces += QuestionAdded;

            this.tableLeft.Controls.Add(diagramView.getTable(), 0, 0);
            this.tableWrapper.Controls.Add(addQuestionView.getTable(), 1, 0);
        }
コード例 #2
0
        public void TestSaveQuestion_shouldAddQuestionToList()
        {
            TestAddQuestionView view = new TestAddQuestionView();
            AddQuestionController controller = new AddQuestionController();
            controller.SetBaseFactory(new TestQuestionFactory());
            controller.SetView(view);

            Model.QuestionList list = new Model.QuestionList();
            list.Id = 1;
            controller.SetQuestionList(list);

            Dictionary<string, object> data = new Dictionary<string, object>();
            data["Points"] = 2;
            data["Time"] = 5;
            data["Text"] = "Test Vraag";
            data["PredefinedAnswerCount"] = 0;
            controller.SaveQuestion(data);

            Assert.AreEqual(view.CountAddQuestionList(), 1);
        }
コード例 #3
0
        public void TestUpdateQuestion_ShouldReturnTrue()
        {
            TestUpdateQuestionView view = new TestUpdateQuestionView();

            AddQuestionController controller = new AddQuestionController();
            controller.SetBaseFactory(new TestQuestionFactory());
            controller.SetView(view);

            Model.QuestionList list = new Model.QuestionList();
            list.Id = 1;
            controller.SetQuestionList(list);

            List<Model.PredefinedAnswer> answersNew = new List<Model.PredefinedAnswer>() { new Model.PredefinedAnswer() { Text = "test2" } };
            Dictionary<string, object> dataNew = new Dictionary<string, object>();
            dataNew["Points"] = 2;
            dataNew["Time"] = 2;
            dataNew["Text"] = "test2";
            dataNew["PredefinedAnswerCount"] = answersNew.Count;
            dataNew["Id"] = 1;

            controller.UpdateQuestion(dataNew);

            Assert.AreEqual(true, view.questionIsUpdated);
        }