コード例 #1
0
        // GET: api/Answer
        public IEnumerable <Answer> Get()
        {
            AnswerList answers = new AnswerList();

            answers.Load();
            return(answers);
        }
コード例 #2
0
ファイル: utAnswer.cs プロジェクト: B-Lemke/FVTC_SurveyMaker
        public void LoadTest()
        {
            AnswerList answers = new AnswerList();

            answers.Load();

            int expected = 8;
            int actual   = answers.Count;

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
ファイル: utAnswer.cs プロジェクト: B-Lemke/FVTC_SurveyMaker
        public void DeleteTest()
        {
            //Load all answers and then get the answer
            AnswerList answers = new AnswerList();

            answers.Load();
            Answer answer = answers.FirstOrDefault(q => q.Text == "ChangedText");

            int actual = answer.Delete();

            Assert.IsTrue(actual > 0);
        }
コード例 #4
0
ファイル: utAnswer.cs プロジェクト: B-Lemke/FVTC_SurveyMaker
        public void UpdateTest()
        {
            //Load all answers and then get the answer
            AnswerList answers = new AnswerList();

            answers.Load();
            Answer answer = answers.FirstOrDefault(q => q.Text == "TestAnswer");

            //Change the properties
            answer.Text = "ChangedText";

            //Update the answer
            answer.Update();

            //Load it
            answer.LoadById();

            Assert.AreEqual(answer.Text, "ChangedText");
        }
コード例 #5
0
        public ManageQAs(QAMode mode)
        {
            try
            {
                InitializeComponent();

                //Adjust labels and title for the mode
                lblQOrA.Content = mode.ToString() + "s:";
                Title           = "Manage " + mode.ToString() + "s";

                //save the mode in a modular level variable
                qaMode = mode;

                //Instantiate the proper list
                switch (mode)
                {
                case QAMode.Answer:
                    answers = new AnswerList();
                    answers.Load();
                    break;

                case QAMode.Question:
                    questions = new QuestionList();
                    questions.LoadQuestions();

                    break;

                default:
                    break;
                }

                rebindComboBox(mode);

                //Select the first item in the combobox
                cboQorAs.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                lblStatus.Content = ex.Message;
            }
        }
コード例 #6
0
        private void LoadComboBoxes()
        {
            //Clear out status label
            lblStatus.Content = String.Empty;

            //Load all questions and set to the combo boxes
            cboQuestion.ItemsSource       = null;
            cboQuestion.ItemsSource       = questions;
            cboQuestion.DisplayMemberPath = "Text";
            cboQuestion.SelectedValuePath = "Id";

            //Load all answers and set to the combo boxes
            answers = new AnswerList();
            answers.Load();

            cboCorrectAnswer.ItemsSource       = null;
            cboCorrectAnswer.ItemsSource       = answers;
            cboCorrectAnswer.DisplayMemberPath = "Text";
            cboCorrectAnswer.SelectedValuePath = "Id";

            cboWrongAnswer1.ItemsSource       = null;
            cboWrongAnswer1.ItemsSource       = answers;
            cboWrongAnswer1.DisplayMemberPath = "Text";
            cboWrongAnswer1.SelectedValuePath = "Id";

            cboWrongAnswer2.ItemsSource       = null;
            cboWrongAnswer2.ItemsSource       = answers;
            cboWrongAnswer2.DisplayMemberPath = "Text";
            cboWrongAnswer2.SelectedValuePath = "Id";

            cboWrongAnswer3.ItemsSource       = null;
            cboWrongAnswer3.ItemsSource       = answers;
            cboWrongAnswer3.DisplayMemberPath = "Text";
            cboWrongAnswer3.SelectedValuePath = "Id";

            cboQuestion.SelectedIndex = 0;
        }