Exemplo n.º 1
0
        public async Task ShouldBeAbleToGetAllQuestions()
        {
            var dbQuestions = await Arranger.CreateQuestions();

            var responseQuestionDtos = await ApiClient.GetAllQuestions()
                                       .AwaitGetSuccessfulResponse <IEnumerable <QuestionDto> >();

            var responseQuestions = Mapper.Map <IEnumerable <Question> >(responseQuestionDtos);

            responseQuestions = responseQuestions.Where(rq => dbQuestions.Any(dq => dq.Id == rq.Id));

            Assert.IsTrue(responseQuestions.CompareCollectionsUsingLikeness(dbQuestions));
        }
        public async Task ShouldBeAbleToCreateAnInterviewTemplateWithQuestions()
        {
            var requestInterviewTemplate = Stubber.StubInterviewTemplateDto();

            var questions = await Arranger.CreateQuestions();

            requestInterviewTemplate.QuestionIds = questions.Select(q => q.Id);

            var responseInterviewTemplate = await ApiClient.PostInterviewTemplate(requestInterviewTemplate)
                                            .AwaitGetSuccessfulResponse <InterviewTemplateDto>();

            responseInterviewTemplate
            .ToLikeness()
            .WithCollectionSequenceEquals(o => o.QuestionIds)
            .ShouldEqual(requestInterviewTemplate);
        }