private void Add_Click(object sender, RoutedEventArgs e)
 {
     if (Reply != null && MoveToFAQ != null)
     {
         if ((bool)MoveToFAQ.IsChecked)
         {
             Questions.selectedQuestion.question.FrequentlyAsked = true;
             QuestionReply questionReply = new QuestionReply();
             questionReply.Author  = MainWindow.doctor;
             questionReply.Content = Reply.Text;
             questionReply.Date    = DateTime.Today;
             questionController.AnswerQuestion(Questions.selectedQuestion.question, questionReply);
         }
         else
         {
             Questions.selectedQuestion.question.FrequentlyAsked = false;
             QuestionReply questionReply = new QuestionReply();
             questionReply.Author  = MainWindow.doctor;
             questionReply.Content = Reply.Text;
             questionReply.Date    = DateTime.Today;
             questionController.AnswerQuestion(Questions.selectedQuestion.question, questionReply);
         }
         Replies.Navigate(new Uri("/Pages/BlogPages/Questions.xaml", UriKind.Relative));
     }
 }
Ejemplo n.º 2
0
        public async Task AnswerQuestion_ShouldReturn_BadRequestIfNoSessionId()
        {
            _controller.Request.Cookies = new RequestCookieCollection();

            var result = await _controller.AnswerQuestion("short", "1");

            Assert.IsType <BadRequestResult>(result);
        }
Ejemplo n.º 3
0
        public async Task GetPoints_Returns_The_Correct_Number()
        {
            // Arrange
            var count        = 2;
            var questionList = GetQuestionList();
            var controller   = new QuestionController(questionList);
            var sessionId    = "session1337";

            // Act
            for (int i = 0; i < questionList.Questions.Count(); i++)
            {
                var questionActionResult = await controller.NextQuestion(sessionId);

                await controller.AnswerQuestion(new AnswerContract { SessionId = sessionId, QuestionId = questionActionResult.Value.Id, Answer = 'A' });
            }
            var pointsActionResult = await controller.GetPoints(sessionId);

            // Assert
            Assert.Equal(count, pointsActionResult.Value);
        }