public void CreateTestViewQuestionList_ShouldReturnItemCountOffThree()
        {
            TestViewQuestionList view = new TestViewQuestionList();
            ListQuestionListController QuestionListController = new ListQuestionListController(view);
            QuestionListController.SetBaseFactory(new TestQuestionListFactory());
            QuestionListController.Load();

            Assert.AreEqual(view.getCount(), 3);
        }
        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);
        }
        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);
        }
        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);
        }
        public void SelectListByIdWithTwoQuestions_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.getById(2);

            Assert.AreEqual(list.MCQuestions.Count, 2);
        }
        public void TestDeleteList_ShouldRemoveFromList()
        {
            ViewDeleteQuestionList view = new ViewDeleteQuestionList();
            ListQuestionListController controller = new ListQuestionListController();
            controller.SetBaseFactory(new TestQuestionListFactory());
            controller.SetView(view);

            Model.QuestionList testList = new Model.QuestionList();
            testList.Name = "Test List";

            //list have 1 items
            view.AddItem(testList);

            controller.DeleteQuestionList(testList);

            //list is empty
            Assert.AreEqual(view.QuestionList.Count, 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");
        }