public void Setup()
 {
     _talksApi = A.Fake<ITalksApi>();
     _expectedDateTime = DateTime.Now;
     _easyAccessKey = "talk_key";
     _viewModel = CreateFeedbackViewModelStub(_easyAccessKey);
     _expectedResponse = CreateFeedbackViewModelResponse(_viewModel);
 }
Exemplo n.º 2
0
 public HttpResponseMessage PostFeedbackForm(string easyAccessKey, FeedbackResponse response)
 {
     return Post($"talks/{easyAccessKey}/Reviews", response);
 }
Exemplo n.º 3
0
        private HttpResponseMessage PostFeedbackAnswers(FeedbackFormViewModel feedbackFormAnswers)
        {
            var easyAccessKey = feedbackFormAnswers.EasyAccessKey;

            var feedbackResponse = new FeedbackResponse
            {
                TalkId = feedbackFormAnswers.TalkId,
                ReviewerId = "",
                Questionnaire = feedbackFormAnswers.Questionnaire.Select(x => new Question
                {
                    QuestionId = x.QuestionId,
                    IsRequired = x.IsRequired,
                    QuestionText = x.QuestionText,
                    AnswerType = x.AnswerType,
                    Answer = x.Answer
                }).ToList(),
                SubmissionTime = DateTime.Now
            };

            var feedbackSubmissionResponse = _talksApi.PostFeedbackForm(easyAccessKey, feedbackResponse);
            return feedbackSubmissionResponse;
        }
        private FeedbackResponse CreateFeedbackViewModelResponse(FeedbackFormViewModel model)
        {
            var response = new FeedbackResponse
            {
                TalkId = model.TalkId,
                ReviewerId = "",
                Questionnaire = model.Questionnaire.Select(x => new Question
                {
                    QuestionId = x.QuestionId,
                    IsRequired = x.IsRequired,
                    QuestionText = x.QuestionText,
                    AnswerType = x.AnswerType,
                    Answer = x.Answer
                }).ToList(),
                SubmissionTime = _expectedDateTime
            };

            return response;
        }