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); }
public async Task <IHttpActionResult> GetAllQuestions( [FromUri] BaseSearchModel searchModel, CancellationToken cancellationToken = default(CancellationToken)) { return(await ExecuteAsync <IHttpActionResult>(() => { return Ok(questionBc.GetSearchQuery(searchModel)); }, cancellationToken)); }