public void QuestionFind_returns_null_question_if_is_unavailable()
        {
            var firstQuestion = new Question { Id = 1, SurveyId = 1 };

            var questionsRepository = new InMemoryQuestionsRepository();
            questionsRepository.Create(firstQuestion);

            var nextQuestion = new QuestionFinder(questionsRepository).FindNext(firstQuestion.Id);

            Assert.That(nextQuestion, Is.Null);
        }
        public void Build_a_response_using_Gather_if_the_question_type_is_Numeric_or_YesNo(
            int id, string body, QuestionType type)
        {
            var question = new Question { Id = id, Body = body, Type = type };
            var response = new Response(question).Build();
            var expectedResponse = string.Format(
                "<Response>\r\n" +
                "  <Say>{0}</Say>\r\n" +
                "  <Say>{1}</Say>\r\n" +
                "  <Gather action=\"/answers/create?questionId={2}\" />\r\n" +
                "</Response>", question.Body, Response.QuestionTypeToMessage[question.Type], question.Id);

            Assert.That(response.ToString(), Is.EqualTo(expectedResponse));
        }
        public void Build_a_response_using_Record_if_the_question_type_is_Voice()
        {
            var question = new Question
            {
                Id = 1,
                Body = "How's the weather?",
                Type = QuestionType.Voice
            };
            var response = new Response(question).Build();
            var expectedResponse = string.Format(
                "<Response>\r\n" +
                "  <Say>{0}</Say>\r\n" +
                "  <Say>{1}</Say>\r\n" +
                "  <Record action=\"/answers/create?questionId={2}\" />\r\n" +
                "</Response>", question.Body, Response.QuestionTypeToMessage[question.Type], question.Id);

            Assert.That(response.ToString(), Is.EqualTo(expectedResponse));
        }
 private static string GenerateUrl(Question question)
 {
     return string.Format("/answers/create?questionId={0}", question.Id);
 }
 public Response(Question question)
 {
     _question = question;
 }