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 RenameQuestionList(int Id, String name, ListQuestionListController Controller)
        {
            InitializeComponent();

            this.Controller = Controller;

            this.QuestionListId = Id;
            this.QuestionListNameChanged = false;
            this.textBox.Text = name;
        }
        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);
        }
        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);
        }
Exemple #9
0
        static void Main()
        {
            bool student = false;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Form AppView = null;

            if (student)
            {
                StartView view = new StartView();
                ShowStartController controller = new ShowStartController(view);

                AppView = view;
            }
            else
            {
                MainView view = new MainView();
                MainController maincontroller = new MainController(view);

                ListQuestionView viewQuestion = new ListQuestionView();
                ListQuestionController questionController = new ListQuestionController(viewQuestion);
                maincontroller.AddController(questionController);

                ListQuestionListView viewQuestionList = new ListQuestionListView();
                ListQuestionListController listQuestionListController = new ListQuestionListController(viewQuestionList);
                maincontroller.AddController(listQuestionListController);

                listQuestionListController.SelectedListChanged += questionController.LoadList;
                listQuestionListController.Load();

                AppView = view;
            }

            Application.Run(AppView);
        }
        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");
        }