public void Create_Answers_stores_an_answer_in_the_database()
        {
            var questionsRepositoy = new InMemoryQuestionsRepository();
            var answersRepository = new InMemoryAnswersRepository();

            questionsRepositoy.Create(new Question { Id = 1, Body = "Question" });
            questionsRepositoy.Create(new Question { Id = 2, Body = "Question" });

            var controller = GetAnswersController(
                questionsRepositoy, answersRepository);

            var answer = new Answer
            {
                QuestionId = 1,
                RecordingUrl = "http://recording.info/n17sugA",
                Digits = "#",
                CallSid = "9s883999dis0039",
                From = "+29999999"
            };

            controller.Create(answer);

            var answers = answersRepository.All();
            Assert.That(answers, Contains.Item(answer));
        }
        public void Create_Answers_stores_an_answer_in_the_database()
        {
            var questionsRepositoy = new InMemoryQuestionsRepository();
            var answersRepository  = new InMemoryAnswersRepository();

            questionsRepositoy.Create(new Question {
                Id = 1, Body = "Question"
            });
            questionsRepositoy.Create(new Question {
                Id = 2, Body = "Question"
            });

            var controller = GetAnswersController(
                questionsRepositoy, answersRepository);

            var answer = new Answer
            {
                QuestionId   = 1,
                RecordingUrl = "http://recording.info/n17sugA",
                Digits       = "#",
                CallSid      = "9s883999dis0039",
                From         = "+29999999"
            };

            controller.Create(answer);

            var answers = answersRepository.All();

            Assert.That(answers, Contains.Item(answer));
        }
        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);
        }
Example #4
0
        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);
        }