コード例 #1
0
ファイル: QuestionBcTests.cs プロジェクト: JPAlvez/bliss-api
        public void QuestionBcTests_GetAllQuestions()
        {
            var random   = TestUtils.RandomString(10);
            var question = new QuestionRequestModel
            {
                Question = $"Random question {random} with choice (GetAll)",
                ImageUrl = "https://www.google.pt/search?q=image",
                ThumbUrl = "https://www.google.pt/search?q=thumb",
                Choices  = new[] { $"choice1_{random}", $"choice2_{random}", $"choice3_{random}" }
            };

            questionBc.CreateQuestion(question);

            var search = new BaseSearchModel
            {
                Limit  = 1,
                Offset = 0,
                Filter = random
            };

            var result = questionBc.GetSearchQuery(search);

            Assert.IsTrue(result.Count() >= 1);

            var choices = result.FirstOrDefault().Choices;

            Assert.IsNotNull(choices);
            Assert.IsTrue(choices.Count() > 1);
        }
コード例 #2
0
 public async Task <IHttpActionResult> GetAllQuestions(
     [FromUri] BaseSearchModel searchModel,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     return(await ExecuteAsync <IHttpActionResult>(() =>
     {
         return Ok(questionBc.GetSearchQuery(searchModel));
     }, cancellationToken));
 }