コード例 #1
0
        public void CreateTestViewQuestionList_ShouldReturnItemCountOffThree()
        {
            TestViewQuestionList view = new TestViewQuestionList();
            ListQuestionListController QuestionListController = new ListQuestionListController(view);
            QuestionListController.SetBaseFactory(new TestQuestionListFactory());
            QuestionListController.Load();

            Assert.AreEqual(view.getCount(), 3);
        }
コード例 #2
0
        public void SelectListByIdWithNoQuestions_ShouldReturnQuestionAmountOfZero()
        {
            TestViewQuestionList view = new TestViewQuestionList();
            ListQuestionListController QuestionListController = new ListQuestionListController(view);
            QuestionListController.SetBaseFactory(new TestQuestionListFactory());
            QuestionListController.Load();

            Model.QuestionList list = view.getQuestionlists()[1];

            Assert.AreEqual(list.MCQuestions.Count, 0);
        }
コード例 #3
0
        public void RemoveItemFromListWithIndex_ShouldReturnItemCountOffTwo()
        {
            TestViewQuestionList view = new TestViewQuestionList();
            ListQuestionListController QuestionListController = new ListQuestionListController(view);
            QuestionListController.SetBaseFactory(new TestQuestionListFactory());
            QuestionListController.Load();

            view.RemoveAt(1);

            Assert.AreEqual(view.getCount(), 2);
        }
コード例 #4
0
        public void AddItemToList_ShouldReturnItemCountOffFour()
        {
            TestViewQuestionList view = new TestViewQuestionList();
            ListQuestionListController QuestionListController = new ListQuestionListController(view);
            QuestionListController.SetBaseFactory(new TestQuestionListFactory());
            QuestionListController.Load();

            view.AddItem(new Model.QuestionList());

            Assert.AreEqual(view.getCount(), 4);
        }
コード例 #5
0
        public void CreateNewList_ShouldHaveListCountOffFour()
        {
            TestViewQuestionList view = new TestViewQuestionList();
            ListQuestionListController QuestionListController = new ListQuestionListController(view);
            QuestionListController.SetBaseFactory(new TestQuestionListFactory());
            QuestionListController.Load();

            Dictionary<string, object> data = new Dictionary<string, object>();
            data["Name"] = "4";
            QuestionListController.SaveQuestionList(data);

            Assert.AreEqual(view.getCount(), 4);
        }
コード例 #6
0
        public void SelectListByIndexWithTwoQuestions_ShouldReturnQuestionAmountOfTwo()
        {
            TestViewQuestionList view = new TestViewQuestionList();
            ListQuestionListController QuestionListController = new ListQuestionListController(view);
            QuestionListController.SetBaseFactory(new TestQuestionListFactory());
            QuestionListController.Load();

            Model.Question q = new Model.Question();
            view.AddToList(q, 1);
            view.AddToList(q, 2);
            view.AddToList(q, 2);

            Model.QuestionList list = view.getItem(1);

            Assert.AreEqual(list.Id, 2);
        }
コード例 #7
0
        public void SelectListByListId_ShouldReturnRightIdAndName()
        {
            TestViewQuestionList view = new TestViewQuestionList();
            ListQuestionListController QuestionListController = new ListQuestionListController(view);
            QuestionListController.SetBaseFactory(new TestQuestionListFactory());
            QuestionListController.Load();
            Model.QuestionList list = view.getById(2);

            Assert.AreEqual(list.Id, 2);
            Assert.AreEqual(list.Name, "2");
        }