コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }