public TwiMLResult Create( [Bind(Include = "QuestionId,RecordingUrl,Digits,CallSid,From")] Answer answer) { _answersRepository.Create(answer); var nextQuestion = new QuestionFinder(_questionsRepository).FindNext(answer.QuestionId); return TwiML(nextQuestion != null ? new Response(nextQuestion).Build() : ExitResponse); }
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); }